... with() is useful here: e.g. in base R, simply tapply() or ave() with with()
with(df,ave(x, comn,mi, FUN = sd))
-- Bert
On Sun, Dec 4, 2011 at 1:07 PM, John Kane wrote:
> ?aggregate should do it
>
> aggregate(df$x,list(df$comn, df$mi), sd)
>
> There are other ways of course
>
> Using the
?aggregate should do it
aggregate(df$x,list(df$comn, df$mi), sd)
There are other ways of course
Using the reshape2 package
library(reshape2)
x1 <- melt(df, id=c("comn", "mi"))
dcast(x1, comn + mi ~ variable, sd)
--- On Sun, 12/4/11, Aurélien PHILIPPOT wrote:
> From: Aurélien PHILIPPOT
>
Aurélien PHILIPPOT wrote
>
> Dear R-experts,
> I am struggling with the following problem, and I am looking for advice
> from more experienced R-users: I have a data frame with 2 identifying
> variables (comn and mi), and an output variable (x). comn is a variable
> for
> a company and mi is a va
exactly like that!
thanks a lot.
Aurelien
2011/12/4 Felipe Carrillo
> Like this?
> library(plyr)
> ddply(df,.(comn,mi),summarise,stDEV=sd(x))
>
> Felipe D. Carrillo
> Supervisory Fishery Biologist
> Department of the Interior
> US Fish & Wildlife Service
> California, USA
> http://www.fws.gov/
Like this?
library(plyr)
ddply(df,.(comn,mi),summarise,stDEV=sd(x))
Felipe D. Carrillo
Supervisory Fishery Biologist
Department of the Interior
US Fish & Wildlife Service
California, USA
http://www.fws.gov/redbluff/rbdd_jsmp.aspx
From: Aurélien PHILIPPOT
>To: R-help@r-project.org
>Sent: Sunda
5 matches
Mail list logo