On Wed, 5 Dec 2007, Ranjan Bagchi wrote: > Hi -- > > I just noticed the following (R 2.6.1 on OSX) > >> lapply(c(as.Date('2007-01-01')), I) > [[1]] > [1] 13514 > > This is a bit surprising.. Why does lapply unclass the object? Sorry for > such a basic question, I don't seem able to produce the right google keywords.
Did you not read the help page?: Arguments: X: a vector (atomic or list) or an expressions vector. Other objects (including classed objects) will be coerced by 'as.list'. and > as.list(c(as.Date('2007-01-01'))) [[1]] [1] 13514 BTW, the c() is redundant here: you are concatenating one item only. As to why as.list() removes the class, read its help page which tells you. Perhaps if you told us what you are trying to achieve we might be able to help you achieve it. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595 ______________________________________________ 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.