[R] Assigning objects to variable and variable to list in a for loop

2012-02-03 Thread Johannes Radinger
Hello, I want to use a for loop for repeadely calculating a maxent model (package dismo, function maxent()) which creates an object of the class maxent (S4). I want to collect all the resulting object in a list. I tried to simplify my for loop to explain what I want. There are two

Re: [R] Assigning objects to variable and variable to list in a for loop

2012-02-03 Thread Joshua Wiley
Hi Johannes, There is a relatively elegant solution if you assign in a list: reslist - lapply(1:3, function(x) runif(5)) names(reslist) - paste(result, LETTERS[1:3], sep = _) Cheers, Josh On Fri, Feb 3, 2012 at 2:07 AM, Johannes Radinger jradin...@gmx.at wrote: Hello, I want to use a for

Re: [R] Assigning objects to variable and variable to list in a for loop

2012-02-03 Thread Johannes Radinger
Hello, I tried to use the lapply approach, but I am not sure how to se it correctly for my task. Here I just want to give an short script which explains how my data structure looks like. It also contains the second approach with a for loop which is working but there is the question of how

Re: [R] Assigning objects to variable and variable to list in a for loop

2012-02-03 Thread Steve Lianoglou
Hi, On Fri, Feb 3, 2012 at 8:00 AM, Johannes Radinger jradin...@gmx.at wrote: Hello, I tried to use the lapply approach, but I am not sure how to se it correctly for my task. Here I just want to give an short script which explains how my data structure looks like. It also contains the

Re: [R] Assigning objects to variable and variable to list in a for loop

2012-02-03 Thread Johannes Radinger
hi, Original-Nachricht Datum: Fri, 3 Feb 2012 09:04:19 -0500 Von: Steve Lianoglou mailinglist.honey...@gmail.com An: Johannes Radinger jradin...@gmx.at CC: Joshua Wiley jwiley.ps...@gmail.com, r-help@r-project.org Betreff: Re: [R] Assigning objects to variable and variable