[R] value of strptime in R 1.8.0
RINNER Heinrich
H.RINNER at tirol.gv.at
Wed Nov 12 10:37:56 CET 2003
Dear R-people!
I am using R 1.8.0, under Windows XP.
What I want to do is a date conversion of a character column of a data frame
and assign the result as a new column.
Simple example:
> x <- data.frame(a=c("yesterday","today","tomorrow"), b=I(c("20031111",
"20031112", "20031113")))
# convert x$b from character to date:
> strptime(x$b, format="%Y%m%d")
[1] "2003-11-11" "2003-11-12" "2003-11-13"
# trying to make this a new column in x:
> x$c <- strptime(x$b, format="%Y%m%d")
Error in "$<-.data.frame"(`*tmp*`, "c", value = strptime(x$b, format =
"%Y%m%d")) :
replacement has 9 rows, data has 3
I have done this before (in R 1.7.0), and I am pretty sure this has been
working then.
What am I doing wrong here (has something changed concerning the value of
strptime() in R 1.8.0)?
-Heinrich.
More information about the R-help
mailing list