Skip to content
Prev 285313 / 398502 Next

execute array of functions

I am not sure why you are trying to use this approach in a loop, but you need to use the get() function if you want to do this.

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

But, why not use min and max on n directly?


Hope this is helpful,

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