When length(c) is very large, manual checking is infeasible.
We can set up a for loop to compare and extract the index. However, is there an easier way to do this, so that the output is the sorted vector and their corresponding original indices.
Thanks
Chee
[[alternative HTML version deleted]]
______________________________________________
R-h...@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.
df<-data.frame(V1=c(1,4,3,2))
df$rows<-row.names(df)
df[order(df$V1),]
also, you shouldn't use c as a variable name since its an important R
function...
see your example :)
Justin