Re: [R] looping through variables

2008-09-24 Thread Adaikalavan Ramasamy
Perhaps what you want is get(). apple <- rnorm(5) orange <- runif(5) fruits <- c("apple", "orange") fruit.data <- NULL for( fruit in fruits ){ v <- get(fruit) fruit.data <- cbind(fruit.data, v) } colnames(fruit.data) <- fruits fruit.data Here the resulting

[R] looping through variables

2008-09-24 Thread K. Fleischer
Hello everyone, I have the following problem: My analysis includes many predictor variables (>50) in the form of raster maps (asc), but I am trying to avoid having to type all their names over and over again in the analysis (e.g. for vectorisation, for deletion of NA's, etc.) So ideally I wou