[R] error in barplot

David Winsemius dwinsemius at comcast.net
Fri May 10 03:16:43 CEST 2013


On May 9, 2013, at 2:22 PM, Carol Van Hulle wrote:

> Hi all,
> 
> I am trying to create a barplot for the following data:
> 
>  ssmsm, ssaudmn, sstacmn
>  .35, .93, .63
>  1.9, 1.51., 1.8
>  .78, 1.6, 1.24
>  1.10, 1.60, 1.24
> 
> I used the following code:
> sd<-read.table("dat.csv", header=T, sep=",")
> 
> barplot(as.matrix(sd), main="Figure 1", ylab= "Mean", beside=TRUE, col=rainbow(3))
> legend("topleft", c("low", "chronic", "remitted", "late-onset"), cex=0.6, 
> bty="n", fill=rainbow(3))
> 
> But I get the following error:
> Error in -0.01 * height : non-numeric argument to binary operator

Look at str(sd). (It was a data-entry error.)
> 
> 
-- 

David Winsemius
Alameda, CA, USA



More information about the R-help mailing list