[R] eval(), expression()

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Tue Jul 6 13:47:53 CEST 1999


"Wolfgang Koller" <koller2 at fgr.wu-wien.ac.at> writes:

> Dear R-Users!
> 
> My aim is to produce boxplots without the outliers included in the 
> plot. I started to write a function that looks something like:
> 
> myboxplot <-function(x,fa) {
>   bpdata <- boxplot(x~fa,plot=FALSE)
>   bpnames <- names(bpdata)
>   for (JJ in bpnames) { 
>     command <- paste("bpdata$",JJ,"$out <- numeric(0)",sep="");
>     eval(command)
>   }
>   bxp(bpdata)
> }
> 
> Obviously this does not work as I intended since the argument 
> of eval() should be of type expression. However, with 
> expression() there is no way to have variable JJ evaluated first.
> 
> Does anybody see a way to solve this problem?

bp <- boxplot(..etc..)
for (n in names(bp)) bp[[n]]$out<-numeric(0)

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list