Thanks to everyone for the explanations. Toby
On 27 Aug 2010 at 12:46, Phil Spector wrote: > Toby - > Since dat$doy is just a number, the default S3 method > for format is used, where the second argument is the trim > parameter. I suspect you are confusing format (which is for > output) with strptime (which is for input). > For example, > > strptime(dat$doy,'%j') > > will assume that the dates are in the current year, and > return a POSIXlt object. Alternatively, you could pass > an origin to as.Date: > > as.Date(dat$doy,origin='2009-12-31') > > to get a similar Date object. > > - Phil > > > On Fri, 27 Aug 2010, Toby Gass wrote: > > > Hello, helpeRs, > > > > I have a vector of numbers from 1-365 (days of the year) that I would > > like to convert to a date. There are no NA's and no missing values. > > I did not insert leading zero's for numbers less than 100. > > > > Using the syntax: > > > > dat$doy.1 <- as.numeric(format(dat$doy, "%j" )) > > > > I get the following error message: > > > > Error in prettyNum(.Internal(format(x, trim, digits, nsmall, width, > > 3L, : > > invalid 'trim' argument > > > > .What is the error message telling me? > > (Windows OS and R 2.11.1) > > > > > > Thank you. > > > > Toby > > > > ______________________________________________ > > 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. > > > ______________________________________________ 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.