Hi I like to create a list of functions dynamically. The only thing is that I have stored variables that I like to input as my function. For example, say I have a named vector with color.
color = c("blue","red")
names ( color) = c("a","b")
Now I want to create a list of dynamic function returning the color.
c = list()
for ( n in names ( color)){
c[[n]]= function ( x){
return ( color[n])
}
}
however as you can see it returns "color[n]" and not the evaluated value.
> c$a
function ( x){
return ( color[n])
}
<bytecode: 0x0000000105e0a108>