Toby,

What is it that you're trying to accomplish?

There seems to be several ideas confused in your post.

It sounds like you have input

x <- 1:365

and you want to call some function to return dates?
Which date should be returned for input 1?

January 1, 2010?

Your error is because if you give format a numeric
vector, the second argument is "trim", which needs
to be TRUE or FALSE, and you're giving it "%j",
which I can only assume to be an attempt to pass
one of the ?strptime format specifiers to the function.

But those come into play when you're trying to format
a Date to a character string, which is not what you have
at all.

So please give a reproducible example (we don't have
your 'dat' object, for instance) that we can run on
our own to get a good answer to you.




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.

Reply via email to