Thanks! I got the results! Now I would like to put them in a nice and
readable plot to see if there are outlier means or variances. Using
"plot(by_many$mean)" I got "Error in by_many$mean : object of type 'closure'
is not subsettable".
Another question: I have done the principal components analys
On 12/14/2010 01:14 AM, effeesse wrote:
I am sorry, but I cannot understand how to use the "summary" function. Maybe,
if I describe my needs, you could sketch a line that could work.
In the data set variable "V" can take values 1 to 14. For the subgroup of
individuals where "V" takes value =1 I
You could also use aggstat() of package tdisplay (available at
http://forums.cirad.fr/logiciel-R/viewtopic.php?t=3367). See the help
page.
> mydata <- data.frame(
+ y1 = c(NA, rnorm(n = 8, mean = 10, sd = 5), NA),
+ y2 = c(rep(NA, 2), rnorm(n = 6, mean = 10, sd = 5), rep(NA, 2)),
+ y3
Do it with aggregate(), something like this should do:
aggregate(.~cluster, FUN=summary, data=data)
Now if you don't want to run summary(), replace it with the function
you'd like.
HTH,
Ivan
Le 12/13/2010 17:17, effeesse a écrit :
what am I supposed to put into function(x)? The indicator for
An alternative way of getting summary statistics by a grouping
variable is to use describe.by in the psych package:
using Jim Lemon's example:
library(psych)
testmat<-data.frame(sample(1:14,50,TRUE),rnorm(50),runif(50)) #make
up the data
describe.by(test.mat,testmat[1]#get descriptive st
what am I supposed to put into function(x)? The indicator for extracting the
subgroups?
data is the df. cluster={1,...,14}.
This is how I was compiling:
"for (i in 1:14) {
my.summary<-data$cluster==i c(mean(?),var(?))
summary(var_A~cluster, fun=my.summary,data=data)
summary(var_B~cluster, fun=m
With summary do this
my.summary<-function(x) c(mean(x),var(x))
summary(v1~V, fun=my.summary,data=df)
summary(v2~V, fun=my.summary,data=df)
summary(v3~V, fun=my.summary,data=df)
summary(v4~V, fun=my.summary,data=df)
summary(v5~V, fun=my.summary,data=df)
If you want you get the mean of all variabl
7 matches
Mail list logo