[R] list & calculaton in many df subsets

Spencer Graves spencer.graves at pdf.com
Tue May 18 17:18:33 CEST 2004


Have you considered "lapply(by(...), ...)"?  The help for "by" includes 
an example using sapply.  See also Venables and Ripley, Modern Applied 
Statistics with S. 

hope this helps.  spencer graves

Christian Schulz wrote:

>Hi,
>
>have anybody a hint /starting point how i can 
>enlarge my code that's posiible for me make any  calculaton's
>with variables in the  64 subset's.
>
>Example: 
>I want calculate difference of two variables inside every
>of the 64 subset data.frames  and getting this value in tList!
>
>Many thanks,
>Christian
>
>
>tasign <- paste("tList[[n]]  <-   try(dtree[dtree$class02 == 
>paste(data$class02[n]) & dtree$class04 == paste(data$class04[n]) & 
>dtree$PREDICT==paste(data$PREDICT[n]),])")
>tasign <-  parse(text=tasign)[[1]]
>          
>for(n in 1:nrow(data)) {
>  TAsign <- do.call("substitute",list(tasign,list(n=n,X=as.name(n))))
>  eval(TAsign)
>}
>
>______________________________________________
>R-help at stat.math.ethz.ch mailing list
>https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>  
>




More information about the R-help mailing list