>
> In that case, you probably want:
>
> subsets.melt <- melt(subsets.dummy,id.vars=c("State","Bedroom", "Months"))
> cast(subsets.melt, State ~ Months, fill = 0, fun = length)
>
> Hadley
>
Dear Hadley,
> subsets.melt <- melt(subsets.dummy,id.vars=c("State","Bedroom", "Months"))
> subsets.melt
State Bedroom Months
1 xxx 1 Jan
2 xxx 2 Jan
3 xxx 1 Jan
4 yyy 1 Jan
5 yyy 2 Jan
6 yyy 1 Jan
7 zzz 3 Jan
8 zzz 1 Jan
9 zzz 2 Jan
10 xxx 3 Feb
11 xxx 4 Feb
12 xxx 2 Feb
13 yyy 1 Feb
14 yyy 2 Feb
15 yyy 1 Feb
16 zzz 2 Feb
17 zzz 3 Feb
18 zzz 3 Feb
> cast(subsets.melt, State ~ Months, fill = 0, fun = length)
It show some thing like this :
Using Months as value column. Use the value argument to cast to override
this choice
Error in `[.data.frame`(data, , variables, drop = FALSE) :
undefined columns selected
Thanks
Mohan L
[[alternative HTML version deleted]]
______________________________________________
[email protected] 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.