the
>> future,
>> I am very grateful. :-)
>>
>> Simon.
>>
>>
>> - Original Message ----- From: "Gabor Grothendieck"
>>
>> To: "Henrique Dallazuanna"
>> Cc: "Simon Pickett" ;
>> Sent: Thursday,
quot;Henrique Dallazuanna"
Cc:
Sent: Thursday, December 18, 2008 12:11 PM
Subject: Re: [R] inserting zero instances with zeroes in a matrix
Thanks Gregor and Henrique for the eloquent and masterful replies,
These solutions have saved me hours (maybe even days) of work in the
future,
ot;Simon Pickett" ;
Sent: Thursday, December 18, 2008 11:51 AM
Subject: Re: [R] inserting zero instances with zeroes in a matrix
Try this:
as.data.frame(xtabs(count ~., d.f))
On Thu, Dec 18, 2008 at 6:25 AM, Henrique Dallazuanna
wrote:
Try this:
with(d.f,
{merge(data.frame(house = re
Try this:
as.data.frame(xtabs(count ~., d.f))
On Thu, Dec 18, 2008 at 6:25 AM, Henrique Dallazuanna wrote:
> Try this:
>
> with(d.f,
>{merge(data.frame(house = rep(unique(house), each =
> length(unique(pet))),
> pet = unique(pet)), d.f, by = c("house", "pet"), all = TRUE)
>
Wow, thats amazing, thanks very much!!!
Simon.
- Original Message -
From: Henrique Dallazuanna
To: Simon Pickett
Cc: r-help@r-project.org
Sent: Thursday, December 18, 2008 11:25 AM
Subject: Re: [R] inserting zero instances with zeroes in a matrix
Try this:
with
Try this:
with(d.f,
{merge(data.frame(house = rep(unique(house), each =
length(unique(pet))),
pet = unique(pet)), d.f, by = c("house", "pet"), all = TRUE)
}
)
On Thu, Dec 18, 2008 at 8:58 AM, Simon Pickett wrote:
> Hi all,
>
> Suppose I had the below example where a s
Hi all,
Suppose I had the below example where a survey was carried out recording the
number of each type of pet in each house
count<-c(2,1,2,1,2,3,4)
house<-c("house1","house1","house2","house3","house4","house4","house4")
pet<-c("dogs","cats","dogs","dogs","budgie","cat","hamster")
d.f<-data.fr
7 matches
Mail list logo