[R] using as.POSIXlt on multiple columns or multiple objects

From: Farrel Buchinsky <fjbuch_at_gmail.com>
Date: Wed, 04 Jun 2008 18:06:24 -0400


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

______________________________________________
R-help_at_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.
Received on Wed 04 Jun 2008 - 22:36:25 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 04 Jun 2008 - 23:30:58 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive