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 I get that sd needs to be a matrix, but I'm not sure why using as.matrix is not good enough. Any suggestions? Thanks, Carol [[alternative HTML version deleted]]
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 operatorLook at str(sd). (It was a data-entry error.)> >-- David Winsemius Alameda, CA, USA
On 05/10/2013 07:22 AM, 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 > > I get that sd needs to be a matrix, but I'm not sure why using as.matrix is not good enough. Any suggestions? >Hi Carol, It is probably the extra "." in the value 1.51 Jim