[R] histogram

Erik Iverson iverson at biostat.wisc.edu
Fri Jun 13 16:33:31 CEST 2008



Paul Adams wrote:
> Hello everyone,
> I am trying to plot a histogram from the following code:
> dat<-read.table(file="C:\\Documents and Settings\\Owner\\My Documents\\Yeast\\Yeast.txt",header=T,row.names=1)
> file.show(file="C:\\Documents and Settings\\Owner\\My Documents\\Yeast\\Yeast.txt")
> x<-dat[2,23:46]
> y=mean(x,trim=0,na.rm=T)
> colMeans(dat[2,23:46])
> boxplot(dat[2,23:46])
> hist(dat[2,23:46])

Check what the class of your object is

class(dat[2, 23:46])

may be a data.frame. If so, you can try to convert accordingly (see 
?as.numeric)

Erik



More information about the R-help mailing list