Could you help me figuring out why the following doesn't work? I have a 2528x3 matrix uniqueitems which looks like that:
Number Created Customer
=========== =================== ============
31464686486 2013-10-25 10:00:00 john@john.de
...
What I'd like to do: Go through every row, check if Created is more recent than a given time and, if so, write the row into a new table newerthantable. Here's my code:
library(lubridate);
newerthan <- function(x) {
times <- ymd_hms(uniqueitems[,2])
newerthantable <- matrix(data=NA,ncol=3,nrow=1)
i <- 1;
while (i <= nrow(uniqueitems)) {
if (x < times[i]) {
newerthantable <- rbind(newerthantable,uniqueitems[i,])
}
i <- i + 1;
}
}
But newerthan("2013-10-24 14:00:00") doesn't have the desired effect :(, nothing is written in newerthantable. Why?