Farrel Buchinsky
2008-Jun-04 22:06 UTC
[R] using as.POSIXlt on multiple columns or multiple objects
If I want to convert one column to date and time format that R can understand and manipulate then I would do this initial$Started<-as.POSIXlt(initial$Started) But what happens if I have many such columns and I do not want to have my code be stuffed with 10 similar lines (one for each variable aka column aka vector aka object) I thought I could be clear and use the list function and do this. list(initial$Started ,initial$Finished,full.ques$started.ful ,full.ques$finished.ful) <- lapply(list(initial$Started ,initial$Finished,full.ques$started.ful ,full.ques$finished.ful),as.POSIXlt) But I got: Error in list(initial$Started, initial$Finished, full.ques$started.ful, : could not find function "list<-" I am clearly missing some basic R issue here. What am I missing? -- Farrel Buchinsky