Re: [R] Why my lapply doesn't work with FUN=as.Date

2012-12-08 Thread Rolf Turner
On 09/12/12 10:34, CHEN, Cheng wrote: Hi, guys I don't understand why I can apply as.Date to a single item in the list: as.Date(alldays[4]) [1] "29-03-20" but when I try to lapply as.Date to all the items, i got a sequence of neg numbers: sapply(alldays[1:4], FUN=as.Date) 03-04-2012 02-04-

Re: [R] Why my lapply doesn't work with FUN=as.Date

2012-12-08 Thread David Winsemius
On Dec 8, 2012, at 1:34 PM, CHEN, Cheng wrote: Hi, guys I don't understand why I can apply as.Date to a single item in the list: as.Date(alldays[4]) [1] "29-03-20" but when I try to lapply as.Date to all the items, i got a sequence of neg numbers: sapply(alldays[1:4], FUN=as.Date) 0

[R] Why my lapply doesn't work with FUN=as.Date

2012-12-08 Thread CHEN, Cheng
Hi, guys I don't understand why I can apply as.Date to a single item in the list: > as.Date(alldays[4]) [1] "29-03-20" but when I try to lapply as.Date to all the items, i got a sequence of neg numbers: > sapply(alldays[1:4], FUN=as.Date) 03-04-2012 02-04-2012 30-03-2012 29-03-2012 -718323