Skip to content
Prev 285318 / 398502 Next

execute array of functions

I probably should have pointed out that the reason your code doesn't work is that type is a vector of character strings with function names, not the actual functions.  Another approach would be to store the actual functions, rather than the names in type.  So something like 

type <- c(min,max)
n <- 1:10
for (a in 1:2) 	  {
  print(type[[a]](n)) 
}


But maybe someone more expert can tell you the 'best' or more R-ish way of accomplishing what you want. 

Dan

Daniel J. Nordlund
Washington State Department of Social and Health Services
Planning, Performance, and Accountability
Research and Data Analysis Division
Olympia, WA 98504-5204