Displaying 1 result from an estimated 1 matches for "fyc04s".
2007 Jun 26
1
Subscripting specified variables in a function
...ous specified variables.  I also want to then
apply some other function(s) (e.g., summary).
 
This is what I've tried so far....
 
> test.fx <- function(dta, expvar, expval) {
+ newdta <- subset(dta, eval(expvar)>expval)
+ summary(newdta$eval(expvar))
+ }
> 
> test.fx(fyc04s, quote(totexp04), 100)
Error in summary(newdta$eval(expvar)) : attempt to apply non-function
> 
 
The subset works fine, but the my attempt to access the specified
variable bombs.  
 
Is there a syntactical change I can make?
Is it better to attach newdta?
 
Thanks in advance for any gu...