search for: thesevar

Displaying 1 result from an estimated 1 matches for "thesevar".

Did you mean: thesevars
2009 Nov 11
1
loop through variable names
Often I perform the same task on a series of variables in a dataframe, by looping through a character vector that holds the names and using paste(), eval(), and parse() inside the loop. For instance: thesevars<-names(environmental) environmental$ToyOutcome<-rnorm(nrow(environmental)) tableOfResults<-data.frame(var=thesevars) tableOfResults$Beta<- NA rownames(tableOfResults)<-thesevars for( thisvar in thesevars) { thiscommand<- paste("thislm <- lm( ToyOutcome ~ ", thisv...