I am a novice user of R and am stumbling on how to order a dataset
produced during my session.
I have a 1863 row X 14 column dataset that I want to put out to a file.
I want the output sorted by the first column and then by the second
column both in ascending order. The first column is character and the
second is numeric (I hope). I used an "as.numeric" function to assign
that variable. Is there a reason R would not accept "0" or "00" as a
numeric value?
I have tried using the order function but the examples I have seen don't
seem to translate for me. I tried something like this assuming my
dataset is called "data".
datanew<-data[order(var1, var2),]
print(datanew)
This generates an "incorrect number of dimensions" error in the order
function. I also tried listing all the variables in the parentheses.
Your help is appreciated.
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.