I started learning R a couple of weeks ago, so I'm still very very new to R coding; I was trying to order a dataframe numerically, but on top of the ordered dataframe, resulted from the execution of the function order(nameofthedataframe), it appears "Warning in xtfrm.data.frame(x) : cannot xtfrm data frames". Could please anyone tell me what did I do wrong?
Thank you very much!
Examples:
order(iris[,"Petal.Width"]) # this seems fine
order(iris[,"Petal.Width",drop=FALSE]) # warning
order(iris[,c("Petal.Width","Sepal.Width")]) # warning
R version 4.1.0
I am using the R version 4.1.0 and it seems like the order() function comes with an error check as you pointed out. You may still try using the order() function as follows,
order(dataframe[,"column"])
Here is a link to an alternative method in an article titled "It Has Always Been Wrong to Call order on a data.frame" by jmount 1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With