-Original Message-
From: Phil Spector [mailto:spec...@stat.berkeley.edu]
Sent: Thursday, February 03, 2011 12:41 PM
To: Graves, Gregory
Cc: r-help@r-project.org; Goodman, Patricia; Gorman, Patricia
Subject: Re: [R] tapply output as a dataframe
Try
as.data.frame(as.table(a
On Thu, Feb 3, 2011 at 1:11 PM, David Winsemius wrote:
>
> On Feb 3, 2011, at 1:05 PM, Graves, Gregory wrote:
>
>> Yes, as far as I can tell, "sampling.date" is a character vector of the
>> format "1/15/2008". It resides in the leftmost column of the tapply output.
>>
>> "station.code" are the A,
sem...@comcast.net]
Sent: Thursday, February 03, 2011 12:50 PM
To: Graves, Gregory
Cc: r-help@r-project.org; Goodman, Patricia; Gorman, Patricia
Subject: Re: [R] tapply output as a dataframe
On Feb 3, 2011, at 11:29 AM, Graves, Gregory wrote:
My tapply output is generated as follows:
a=tappl
February 03, 2011 12:50 PM
To: Graves, Gregory
Cc: r-help@r-project.org; Goodman, Patricia; Gorman, Patricia
Subject: Re: [R] tapply output as a dataframe
On Feb 3, 2011, at 11:29 AM, Graves, Gregory wrote:
> My tapply output is generated as follows:
>
>> a=tapply(value,list(sampling.dat
On Feb 3, 2011, at 11:29 AM, Graves, Gregory wrote:
On Mon, Apr 13, 2009 at 12:41 PM, Dan Dube
wrote:
That is pushing two years ago, so I doubt very many people still have
that posting on their mail-clients. (When I did go to the archives Dan
Dube's problem was posed as how to bind "a":
Try
as.data.frame(as.table(a))
- Phil Spector
Statistical Computing Facility
Department of Statistics
UC Berkeley
On Mon, Apr 13, 2009 at 12:41 PM, Dan Dube wrote:
> i use tapply and by often, but i always end up banging my head against
> the wall with the output.
The proposed solution of Dan's problem posted on R-help was:
> do.call(rbind,a)
When I use this 'solution' I get 'ERROR: second argument must
You can also use sqldf:
> require(sqldf)
> sqldf("select class, `group`, name, avg(height)
+ from myData
+ group by class, 'group', name")
class group name avg(height)
1 0 B Jane58.5
2 0 A Tom62.5
3 1 A Enzo66.5
4 1 B Mary
On 2010-10-06 13:24, Erik Iverson wrote:
Hello,
You can use ddply from the very useful plyr package to do this.
There must be a way using "base R" functions, but plyr is
worth looking into in my opinion.
> install.packages("plyr")
> library(plyr)
> ddply(myData, .(class, group, name),
Geoffrey -
The output you want is exactly what the aggregate() function
provides:
aggregate(myData$height, myData[c('class','group','name')],mean)
class group namex
1 1 A Enzo 66.5
2 0 B Jane 58.5
3 1 B Mary 70.5
4 0 A Tom 62.5
It should be mentioned t
Hello,
You can use ddply from the very useful plyr package to do this.
There must be a way using "base R" functions, but plyr is
worth looking into in my opinion.
> install.packages("plyr")
> library(plyr)
> ddply(myData, .(class, group, name), function(x) mean(x$height))
class group name V
Try this:
aggregate(height ~ class + group + name, data = myData, FUN = mean)
On Wed, Oct 6, 2010 at 4:13 PM, Geoffrey Smith wrote:
> Hello, I am having trouble getting the output from the tapply function
> formatted so that it can be made into a nice table. Below is my question
> written in R
Hello, I am having trouble getting the output from the tapply function
formatted so that it can be made into a nice table. Below is my question
written in R code. Does anyone have any suggestions? Thank you. Geoff
#Input the data;
name <- c('Tom', 'Tom', 'Jane', 'Jane', 'Enzo', 'Enzo', 'Mary',
this is what i needed! thank you.
> -Original Message-
> From: Jorge Ivan Velez [mailto:jorgeivanve...@gmail.com]
> Sent: Monday, April 13, 2009 12:50 PM
> To: Dan Dube
> Cc: r-help@r-project.org
> Subject: Re: [R] tapply output as a dataframe
>
>
&
> do.call(rbind,a)
[,1] [,2] [,3] [,4]
1 -0.7871502 -0.4437714 0.4011135 -0.2626129
2 -0.9546515 0.2210001 0.816 0.1245766
3 -0.5389725 -0.2750984 0.6655951 -0.1873485
4 -0.8176898 -0.1844181 0.4737187 -0.2688996
On Mon, Apr 13, 2009 at 12:41 PM, Dan Dube wrote:
>
Dear Dan,
Try this:
do.call(rbind,a)
HTH,
Jorge
On Mon, Apr 13, 2009 at 12:41 PM, Dan Dube wrote:
> i use tapply and by often, but i always end up banging my head against
> the wall with the output.
>
> is there a simpler way to convert the output of the following tapply to
> a dataframe or
i use tapply and by often, but i always end up banging my head against
the wall with the output.
is there a simpler way to convert the output of the following tapply to
a dataframe or matrix than what i have here:
# setup data for tapply
dt = data.frame(bucket=rep(1:4,25),val=rnorm(100))
fn = f
17 matches
Mail list logo