[R] Updating a list.
rkevinburton at charter.net
rkevinburton at charter.net
Thu Aug 28 03:13:37 CEST 2008
Since this didn't work:
> m2007$DayOfYear <- factor(m2008$DayOfYear, levels = 1:365)
Error in `$<-.data.frame`(`*tmp*`, "DayOfYear", value = c(1L, 1L, 1L, :
replacement has 432267 rows, data has 1592009
Perhaps I need to clarify how the m2007 object was generated.
t2007 <- read.csv("Total2007.dat", header = TRUE)
m2007 <- melt(t2007, id.var=c("DayOfYear","Category","SubCategory","Sku"), measure.var=c("Quantity"))
Kevin
---- hadley wickham <h.wickham at gmail.com> wrote:
>
> Try this:
>
> m2008$DayOfYear <- factor(m2008$DayOfYear, levels = 1:365)
> r2007 <- cast(m2008, DayOfYear ~ variable | Sku, sum, fill = 0)
>
> Hadley
>
> --
> http://had.co.nz/
More information about the R-help
mailing list