On 12-01-10 8:04 AM, Czerminski, Ryszard wrote:
Any ideas what is the problem with this code?
N<- 2; c(Sys.Date(), sprintf('N = %d', N))
[1] "2012-01-10" NA
Warning message:
In as.POSIXlt.Date(x) : NAs introduced by coercion
You are trying to create a vector combining a Date object and a
character object. R is trying to coerce both objects to dates, and that
fails.
You probably want two strings; so convert the date explicitly:
c(as.character(Sys.Date()), sprintf('N = %d', N))
(or use format or some other function to convert the date to a string.)
Duncan Murdoch
Best regards,
Ryszard
Ryszard Czerminski
AstraZeneca Pharmaceuticals LP
35 Gatehouse Drive
Waltham, MA 02451
USA
781-839-4304
ryszard.czermin...@astrazeneca.com
--------------------------------------------------------------------------
Confidentiality Notice: This message is private and may ...{{dropped:11}}
______________________________________________
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.