[R] creating a count variable in R

2011-03-03 Thread JonC
Hi R helpers, I'm trying to create a count in R , but as there is no retain function like in SAS I'm running into difficulties. I have the following : Date_var and wish to obtain Date_var Count_var 01/01/2011

[R] Problems using unique function and !duplicated

2011-02-28 Thread JonC
Hi, I am trying to simultaneously remove duplicate variables from two or more variables in a small R data.frame. I am trying to reproduce the SAS statements from a Proc Sort with Nodupkey for those familiar with SAS. Here's my example data : test <- read.csv("test.csv", sep=",", as.is=TRUE) > t

[R] how to order POSIXt objects ?

2011-02-14 Thread JonC
11-02-14 08:00:01 6 19/01/2011 08:10:01 2011-02-14 08:10:01 7 19/01/2011 08:20:01 2011-02-14 08:20:01 8 19/01/2011 08:30:01 2011-02-14 08:30:01 > test2.sort <- order(test2$DATE, -test2$mytime) Error in `-.POSIXt`(test2$mytime) : unary '-' is not defined for "POSIXt" object