On Tue, May 25, 2010 at 8:39 AM, Mohan L <l.mohan...@gmail.com> wrote: > > > On Tue, May 25, 2010 at 6:59 PM, Hadley Wickham <had...@rice.edu> wrote: >> >> > I trying to get a new data frame for 1 bedroom using cast. But I am not >> > able >> > to get the below data for 1 Bedroom using cost. >> > >> > State Jan Feb >> > xxx 2 0 >> > yyy 2 2 >> > zzz 1 0 >> >> What do those numbers represent? >> >> Hadley >> > > The raw data is real estate & property portal data. the numbers represent > how many 1 Bedroom house has registered in xxx state on particular months. > Then we will normalize the data and plot the graph for trend analysis.
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 -- Assistant Professor / Dobelman Family Junior Chair Department of Statistics / Rice University http://had.co.nz/ ______________________________________________ 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.