Re: [R] histogram

From: Peter Dalgaard <P.Dalgaard_at_biostat.ku.dk>
Date: Fri, 13 Jun 2008 16:41:47 +0200

jim holtman wrote:

> It is hard to respond without reproducible examples.  Do
> str(dat[2,23:46]) and see what it reports.  My guess is that one of
> the columns is not numeric.  Find out which one it is, fix it and then
> try 'hist' again.
>   

No, this will be wrong whatever the data are. The problem is that dat[2,23:46] is a one-row dataframe, i.e. a list, which is not a numeric vector. Possibly
hist(unlist(dat[2,23:46])) is what is wanted. I don't think the boxplot is "fine" either, except in the sense that it does not give an error (try boxplot(airquality[2,])).
> On Fri, Jun 13, 2008 at 10:21 AM, Paul Adams <pma3622_at_yahoo.com> 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])
>> The box plot is fine but the histogram keeps giving me the error that x
>> must be numeric.I am not sure what is wrong here with the instructions
>> for the histogram plot.
>> Any help would be appreciated
>> Paul
>>
>>
>>
>> [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help_at_r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>>
>
>
>
>   


-- 
   O__  ---- Peter Dalgaard             Ă˜ster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark      Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard_at_biostat.ku.dk)              FAX: (+45) 35327907

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Fri 13 Jun 2008 - 17:39:30 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 13 Jun 2008 - 18:30:44 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive