Re: [R] "aggregate" help

2014-04-23 Thread arun
Hi, Please use ?dput() to show the datasets as one of the rows (Id "four") in first dataset didn't show 11 elements. df1 <- structure(list(Id = c("one", "one", "two", "two", "three", "three", "three", "four", "five", "five"), col1 = c("a1", NA, "b1", "b1", NA, NA, "c1", "d1", "e1", NA), col2

Re: [R] aggregate help

2012-09-23 Thread Sam Steingold
   NA    2   y  2    > #2 30    1   c  1      NA    1   z  1    > #  a2.num2 > #0   1 > #1  NA > #2  NA > #It is not an elegant way! > > > A.K. > > > > - Original Message - > From: Sam Steingold >

Re: [R] aggregate help

2012-09-20 Thread arun
Original Message - From: Sam Steingold To: r-help@r-project.org Cc: Sent: Thursday, September 20, 2012 2:06 PM Subject: [R] aggregate help I want to count attributes of IDs: --8<---cut here---start->8--- z <- data.frame(id=c(10,20,10,30,10,20),      

[R] aggregate help

2012-09-20 Thread Sam Steingold
I want to count attributes of IDs: --8<---cut here---start->8--- z <- data.frame(id=c(10,20,10,30,10,20), a1=c("a","b","a","c","b","b"), a2=c("x","y","x","z","z","y"), stringsAsFactors=FALSE) > z id a1 a2 1 10 a

Re: [R] Aggregate Help

2010-08-20 Thread Hall, Ken (CDC/OSELS/NCPHI)
was another problem. Now, all suggestions by all three posts to solve this aggregation work perfectly. Thanks to all. Ken -Original Message- From: David Winsemius [mailto:dwinsem...@comcast.net] Sent: Friday, August 20, 2010 11:12 AM To: Hall, Ken (CDC/OSELS/NCPHI) Subject: Re: [R] Aggreg

Re: [R] Aggregate Help

2010-08-20 Thread William Dunlap
, Ken > (CDC/OSELS/NCPHI) > Sent: Friday, August 20, 2010 7:40 AM > To: Phil Spector > Cc: r-help@r-project.org > Subject: Re: [R] Aggregate Help > > The first one worked great. Thanks for the quick response. > > The second one, with the "with" statement,

Re: [R] Aggregate Help

2010-08-20 Thread Hall, Ken (CDC/OSELS/NCPHI)
di...@gmail.com] Sent: Thursday, August 19, 2010 5:13 PM To: Hall, Ken (CDC/OSELS/NCPHI) Cc: r-help@r-project.org Subject: Re: [R] Aggregate Help On Thu, Aug 19, 2010 at 4:45 PM, Hall, Ken (CDC/OSELS/NCPHI) wrote: > Please let me know if this is or is not the right place to ask these &g

Re: [R] Aggregate Help

2010-08-20 Thread Hall, Ken (CDC/OSELS/NCPHI)
ct: Re: [R] Aggregate Help Ken - Try aggregate(Pilot$Count,list(Date=Pilot$Date,illness=Pilot$illness),sum) If you don't want to keep typing "Pilot", use with(Pilot,aggregate(Count,list(Date=Date,illness=illness),sum)) Notice that the aggregated variable will be called "x&

Re: [R] Aggregate Help

2010-08-19 Thread Gabor Grothendieck
On Thu, Aug 19, 2010 at 4:45 PM, Hall, Ken (CDC/OSELS/NCPHI) wrote: > Please let me know if this is or is not the right place to ask these > types of questions. > > Warning: I am new to R by two days. > > I have a simple dataset. > I have loaded the dataset successfully using the following code: >

Re: [R] Aggregate Help

2010-08-19 Thread David Winsemius
On Aug 19, 2010, at 4:45 PM, Hall, Ken (CDC/OSELS/NCPHI) wrote: Please let me know if this is or is not the right place to ask these types of questions. Warning: I am new to R by two days. I have a simple dataset. I have loaded the dataset successfully using the following code: Filepath=(C:\

Re: [R] Aggregate Help

2010-08-19 Thread Phil Spector
Ken - Try aggregate(Pilot$Count,list(Date=Pilot$Date,illness=Pilot$illness),sum) If you don't want to keep typing "Pilot", use with(Pilot,aggregate(Count,list(Date=Date,illness=illness),sum)) Notice that the aggregated variable will be called "x" in the output data frame from aggregate.

[R] Aggregate Help

2010-08-19 Thread Hall, Ken (CDC/OSELS/NCPHI)
Please let me know if this is or is not the right place to ask these types of questions. Warning: I am new to R by two days. I have a simple dataset. I have loaded the dataset successfully using the following code: Filepath=(C:\temp\\pilot\dataset1.txt") Pilot=read.table(filepath, header=TRUE)