[R] Re: none

About this list Date view Thread view Subject view Author view Other groups

Subject: [R] Re: none
From: Peter Dalgaard BSA (p.dalgaard@biostat.ku.dk)
Date: Sun 27 Feb 2000 - 21:51:14 EST


Message-ID: <x2n1om7tjh.fsf@blueberry.kubism.ku.dk>

Faheem Mitha <faheem@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@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@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b25 : Mon 17 Jul 2000 - 12:33:10 EST