R: great software and wonderful community!
Thanx guys, Gianandrea
--
View this message in context:
http://www.nabble.com/multiple-tapply-tp18868063p18886279.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing
Here are three ways:
# 1
aggregate(iris[-5], iris[5], mean)
# 2
library(doBy)
summaryBy(.~Species, iris, keep = TRUE)
# 3
library(sqldf)
sqldf("select Species,
avg(Sepal_Length) Sepal_Length,
avg(Sepal_Width) Sepal_Width,
avg(Petal_Length) Petal_Length,
avg(Petal_Width) Petal_Width
f
On 8/7/2008 7:01 AM, glaporta wrote:
Hi folk,
I tried this and it works just perfectly
tapply(iris[,1],iris[5],mean)
but, how to obtain a single table from multiple variables?
In tapply x is an atomic object so this code doesn't work
tapply(iris[,1:4],iris[5],mean)
Thanx and great summer holi
On 8/7/2008 7:01 AM, glaporta wrote:
Hi folk,
I tried this and it works just perfectly
tapply(iris[,1],iris[5],mean)
but, how to obtain a single table from multiple variables?
In tapply x is an atomic object so this code doesn't work
tapply(iris[,1:4],iris[5],mean)
Thanx and great summer holi
one way would be:
mapply(tapply, iris[,1:4], MoreArgs=list(iris[,5], mean))
K
On Thu, Aug 7, 2008 at 2:01 PM, glaporta <[EMAIL PROTECTED]> wrote:
>
> Hi folk,
> I tried this and it works just perfectly
> tapply(iris[,1],iris[5],mean)
> but, how to obtain a single table from multiple variables?
>
Try this:
aggregate(iris[,1:4], list(Species = iris[,5]), mean)
On Thu, Aug 7, 2008 at 8:01 AM, glaporta <[EMAIL PROTECTED]> wrote:
>
> Hi folk,
> I tried this and it works just perfectly
> tapply(iris[,1],iris[5],mean)
> but, how to obtain a single table from multiple variables?
> In tapply x is
Hi folk,
I tried this and it works just perfectly
tapply(iris[,1],iris[5],mean)
but, how to obtain a single table from multiple variables?
In tapply x is an atomic object so this code doesn't work
tapply(iris[,1:4],iris[5],mean)
Thanx and great summer holidays
Gianandrea
--
View this message
7 matches
Mail list logo