Re: [R] R help

From: Peter Dalgaard <p.dalgaard_at_biostat.ku.dk>
Date: Tue, 29 Apr 2008 08:28:32 +0200

Erin Hodgess wrote:
> Your data set has 5 variables; res$V1, res$V2....etc
>
> When you plot, you need to do:
> hist(res$V1)
>
>
Yes, but it seems that there is only one row of data? If the intention was just to read 5 numbers into a vector, then use scan(), not read.table(). (A histogram is pretty useless with 5 values, though).
>
> On Mon, Apr 28, 2008 at 8:47 PM, Debasish Roy <debauck@yahoo.com> wrote:
>
>> I tried to read a dataset and then draw a histogram with a freqeuncy density curve fitted on the top of this.
>> I used the command
>>
>> res <- read.table("C:/Documents and Settings/db/Desktop/res.dat")
>> and found
>>
>>> res[1:5]
>>>
>> V1 V2 V3 V4 V5
>> 1 -0.4806 0.5075 0.0491 -0.7985 -0.666
>> Then I got the following when I troied to plot it
>>
>>> hist(res)
>>>
>> Error in hist.default(res) : 'x' must be numeric
>>
>> Even I tried
>>
>>> hist(res[,2])
>>>
>> which is showing a blank plot.

>> My suspision is something is wrong in the way the data was read (with V1, V2, V3 etc). Can someone please help me how to get rid of this problem ?
>>
>>
>> ____________________________________________________________________________________
>> Be a better friend, newshound, and
>> know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
>>
>> ______________________________________________
>> 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 Tue 29 Apr 2008 - 06:37:26 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 Tue 29 Apr 2008 - 07:30:33 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