[R] Saving Iterative Components

jim holtman jholtman at gmail.com
Fri Aug 14 20:57:25 CEST 2009


try something like this using 'list'


results.dataset <- list()
for(i in tracks)

       {

       a <- (subset(data, data$Id==i))

       result.dataset[[i]] <- function(a, other.arguements)

### this function is the other iterative process, but its in another script
and is imported in so dont worry about it.

       }

You will have a list with the values from each iteration that you can access

On Fri, Aug 14, 2009 at 12:00 PM, Phil
T<philiprhodritaylor at googlemail.com> wrote:
>
> Dear All,
>
> I am trying to iterate an iterative process (i know R is not the best place
> for so much looping but i have to so tough!) and store the resulting data
> from each iteration to then be graphed. In simple form the script looks like
> this
>
>
> for(i in tracks)
>
>        {
>
>        a <- (subset(data, data$Id==i))
>
>        result.dataset <- function(a, other.arguements)
>
> ### this function is the other iterative process, but its in another script
> and is imported in so dont worry about it.
>
>        }
>
>
> I want the result.dataset to be unique for each iteration, something like
> result.dataset."i". makes sense to me but not to R! Im teaching myself here
> and apparently im a rubbish teacher so any help would be much appreciated!
> Thanks in advance,
>
> Phil
> --
> View this message in context: http://www.nabble.com/Saving-Iterative-Components-tp24974133p24974133.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org 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.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?




More information about the R-help mailing list