Hi, I have a data frame with variables a, b, c (character vars) and t (time var, could be represented as POSIXct or character, depending on which is most useful. The format is "yyyy-mm-dd hh:mm:ss CET"). Now, I want to sort the data frame in ascending order by a, b, c and then in descending order by t.
Here's what I've got, but I'm not sure how to put the 'descending' bit in the code. The trick with the minus sign doesn't work as the var isn't numeric. idvars <-- c("a", "b", "c") myData["t"] <- as.POSIXct(myData[,"t"]) result <- myData[ do.call(order, myData[c(idvars, "t")]), ] This should be simple, I guess, but I've been staring at this a bit too long now. Suggestions anyone? TIA! Cheers!! Albert-Jan ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a fresh water system, and public health, what have the Romans ever done for us? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [[alternative HTML version deleted]]
______________________________________________ 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.