I got the whole thing to work, with Hadley Wickham's help.
is.POSIXt <- function(x) inherits(x, "POSIXt")
dates <- sapply(df, is.POSIXt)
df[dates] <-lapply(df[dates], as.Date)


Farrel Buchinsky




On Fri, Dec 12, 2008 at 11:26, Farrel Buchinsky <fjb...@gmail.com> wrote:
>
> Something strange. The lapply only processed the first row and then wrote 
> that value to every row of the original dataframe. It is as if the lapply is 
> indeed processing every item on the list, namely each column, but the ifelse 
> or the as.Date is getting messed up. Not only is it only processing the first 
> row but it is also returning the value as numbers rather than dates. I am now 
> playing around with Hadley Wickham's plyr package. So far looking good but 
> still need to work out a few things.

______________________________________________
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.

Reply via email to