[R] interpreting date-related error message
David Winsemius
dwinsemius at comcast.net
Fri Aug 27 21:44:54 CEST 2010
On Aug 27, 2010, at 3:29 PM, 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" ))
That would not make a date. Try:
dat$doy.1 <- as.Date("2010-01-01") + dat$doy -1
>
> 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)
?format
... about its efforts to turn a string "%j" into a logical which is
what a two argument call to format() without named arguments would be
expecting in the second position.
David Winsemius, MD
West Hartford, CT
More information about the R-help
mailing list