[R] for loop

Daniel Malter daniel at umd.edu
Wed Aug 5 19:54:27 CEST 2009


and I may quote David Winsemius at this point: "In general this falls into
the category of a request to "read my mind".

Daniel
-------------------------
cuncta stricte discussurus
-------------------------

-----Ursprüngliche Nachricht-----
Von: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] Im
Auftrag von waltzmiester
Gesendet: Wednesday, August 05, 2009 1:35 PM
An: r-help at r-project.org
Betreff: Re: [R] for loop


The Initial.State function is the setup for Models. So Models will apply the
function to k columns in Initial.State. It will only work for the first
element in vector col however, and will not loop the function through all
elements in vector col

-C





waltzmiester wrote:
> 
> I am trying to get the function "Models" to work each time there is an 
> instance of k. This code will stop after the first model is complete. 
> I need it to come back and pass the next value of c into the
"Initial.State"
> function. any ideas?
> 
> 
> col<-c(23:28)
> 
> #Setup
> for(k in col){
> Initial.State(Response=zample[,c(k,29)],
> Explanatory=zample[,variable_columns],
> IndependentResponse=population[,c(k,29)],
> IndependentExplanatory=population[,variable_columns])
> 
> #Modeling
> Models(GLM=T, GAM=T, RF=T, GBM=T, TSS=T, KeepPredIndependent=T) }
> 
> 
> -Chris
> 

-- 
View this message in context:
http://www.nabble.com/for-loop-tp24830984p24832501.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.




More information about the R-help mailing list