[R] Using R for processing computer performance data

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Sun Apr 29 19:50:37 CEST 2001


"Peter Gallanis" <peter at gallanis.com> writes:

> Thank you for the quick reply, and direction.  I must still be missing
> something though, because I am receiving an error when I try to use by or
> tapply.  Can you please see if I'm doing something correctly in the dialog
> is listed below.
> 
> > diskact<-read.csv("c:/data1/sardisk.csv")
> > diskactF<-factor(diskact$device)
> > by(diskact$busy, diskactF, boxplot)
> Error in Summary.factor(..., na.rm = na.rm) :
>         "range" not meaningful for factors
> In addition: Warning messages:
> 1: "+" not meaningful for factors in: Ops.factor(x[floor(d)], x[ceiling(d)])
> 2: "<" not meaningful for factors in: Ops.factor(x, (stats[2] - coef * iqr))
> 3: ">" not meaningful for factors in: Ops.factor(x, (stats[4] + coef * iqr))
> > tapply(diskact$busy, diskactF, boxplot)
> Error in Summary.factor(..., na.rm = na.rm) :
>         "range" not meaningful for factors
> In addition: Warning messages:
> 1: "+" not meaningful for factors in: Ops.factor(x[floor(d)], x[ceiling(d)])
> 2: "<" not meaningful for factors in: Ops.factor(x, (stats[2] - coef * iqr))
> 3: ">" not meaningful for factors in: Ops.factor(x, (stats[4] + coef * iqr))
> >

by() isn't really designed to be used like that. First argument would
be a data frame and the function would be something working on an
entire frame. 

However, the tapply looks as if it should work (and I wouldn't be
surprised if by() was essentially equivalent to tapply when used that
way). The error you are getting is what you get for attempting to use
boxplot() on a factor variable, which would indicate that something is
wrong with your "busy" variable. Notice that read.csv will turn
variables into factors if they contain *any* values that cannot be
interpreted as numeric (or missing -- notice the na.strings argument).

Apart from that, I suspect that what you really want is

boxplot(Busy~device, data=diskact)

-- 
   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