[R] Re: none

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Sun Feb 27 12:51:14 CET 2000


Faheem Mitha <faheem at email.unc.edu> writes:


> Error in barplot.default(table(x), axisnames = axisnames, ...) : `height'
> must be a vector or a matrix

...
> pollf.df  <- data.frame(hosp,sf,pollutf)
> attach(pollf.df)
> 
> # trying to get plot.factor to do its stuff. Fails with error message
> # quoted above.
> 
> postscript("poll.anova1.ps",width=5.5, height = 5, horizontal=F, pointsize=8)
> par(mfrow=c(2,2),mar=c(5,3,3,1)+0.1)
> plot.factor(pollf.df)
> dev.off()

Well, plot.factor() is a method for the generic function plot() when
the argument is a factor, passing it anything but a factor is asking
for trouble.

What will happen is that it will do table(pollf.df) and try to barplot
that, but table() on a data frame with three variables is a three way
array and barplot() only knows what to do with 1-D or 2-D structures,
hence the error.

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