Hi,
I'm not sure if this is impossible or if I just don't know the syntax.

example:

library(reshape);
library(corpcor);

data<-data.frame(ids=c("A","A","A","B","B","B"),rate=c(12,14,17,10,8,5),sample=c(100,80,60,50,40,45));
data_melted<-melt.data.frame(data,id.vars=c("ids"),measure.vars=c("rate","sample"));

#the line below just gives me the var, can I do weighted var weighted by the
sample size?
data_reshape<-cast(data_melted,ids~variable,function(x,y) wt.var(x,y));

        [[alternative HTML version deleted]]

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to