xtfrm.data.frame(x) 中的警告:无法 xtfrm 数据帧:在 R 中以数字方式排序数据帧时出错

Bet*_*eth 9 r function dataframe

我几周前开始学习 R,所以我对 R 编码仍然非常陌生;我试图以数字方式订购数据帧,但在订购的数据帧之上,由于执行函数 order(nameofthedataframe),出现“xtfrm.data.frame(x) 中的警告:无法 xtfrm 数据帧”。有人可以告诉我我做错了什么吗?

非常感谢!

例子:

order(iris[,"Petal.Width"]) # this seems fine
order(iris[,"Petal.Width",drop=FALSE]) # warning
order(iris[,c("Petal.Width","Sepal.Width")]) # warning
Run Code Online (Sandbox Code Playgroud)

R版本4.1.0

小智 4

我正在使用 R 版本 4.1.0,正如您所指出的, order() 函数似乎带有错误检查。您仍然可以尝试使用 order() 函数,如下所示,

order(dataframe[,"column"])
Run Code Online (Sandbox Code Playgroud)

以下是jmount 发表的题为“在 data.frame 上调用订单总是错误的”文章中的替代方法的链接1