On Tue, May 25, 2010 at 9:35 PM, Wu Gong wrote:
>
> Do you mean count frequency of One Bedroom?
>
> table(dummy[dummy$Bedroom==1,][,1:2])
>
Dear learner,
Thanks for you time.
Yes, that is what I am trying to archive using melt and cost. any way it
works for me . Thanks for your help.
Thank
Hope it helps this time:)
### Package reshape, function melt and cast
### Read table
dummy <- read.table(textConnection("State Months Bedroom
1xxxJan 1
2xxxJan 2
3xxxJan 1
4yyyJan 1
5yyyJan 2
6yyyJan 1
7zzz
Do you mean count frequency of One Bedroom?
table(dummy[dummy$Bedroom==1,][,1:2])
-
A R learner.
--
View this message in context:
http://r.789695.n4.nabble.com/help-required-to-melt-a-data-frame-tp2229633p2230260.html
Sent from the R help mailing list archive at Nabble.com.
__
>
> 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
On Tue, May 25, 2010 at 8:39 AM, Mohan L wrote:
>
>
> On Tue, May 25, 2010 at 6:59 PM, Hadley Wickham 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
>
On Tue, May 25, 2010 at 6:59 PM, Hadley Wickham 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 20
> > yyy 22
> > zzz 10
>
> What do those numbers repr
> 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
--
Assistant Professor / Dobelman Family Junior Chair
Depar
I have the raw data with 9 column and 197977 row:
> dummy
State Months Bedroom
1xxxJan 1
2xxxJan 2
3xxxJan 1
4yyyJan 1
5yyyJan 2
6yyyJan 1
7zzzJan 3
8zzzJan 1
9zzzJan 2
8 matches
Mail list logo