通过减少排序数据帧列时出错(Error sorting dataframe column by decreasing)
我有两列的数据框是第一个单词(Word),第二个是他们的频率(Freq)。 我正在使用sort()函数,但显然我一直陷入同一个陷阱。 我的代码,然后是错误,是:
sorted <- sort(df, order(df$Freq, decreasing= TRUE)) Error in sort(freqmat, order(freqmat$Freq, decreasing = TRUE)) : 'decreasing' must be a length-1 logical vector. Did you intend to set 'partial'?
I've this dataframe of two columns being the first one words(Word)and the second one their frequency (Freq) . I'm using the sort() function but apparently I keep falling into the same trap. My code, followed by the error, is:
sorted <- sort(df, order(df$Freq, decreasing= TRUE)) Error in sort(freqmat, order(freqmat$Freq, decreasing = TRUE)) : 'decreasing' must be a length-1 logical vector. Did you intend to set 'partial'?
原文:https://stackoverflow.com/questions/47191715
更新时间:2023-06-19 13:06