Re: [R] Unable to Plot using headers.

From: stephen's mailinglist account <>
Date: Fri, 27 May 2011 20:13:02 +0100

>> My data is a 2 column 8000 row table (saved as .txt file) imported into
>> R.
>>>demand=read.delim("C:\\Documents and Settings\\E066582\\My
>> Documents\\R\\R-2.13.0\\bin\\demand.txt")
>> First rows with headers are as shown:
>>> demand[1,]
>>        Date Qty
>> 1 12/31/2006   1
>> With two columns Date/Qty.
>> I attempted to plot and received an error. My headers were not found as
>> an object in R...maybe I'm missing something, but I was under the
>> impression I didn't need to create each header as an object...
>>> plot(Qty, Date)
>> Error in plot(Qty, Date) : object 'Qty' not found
>>> plot(Date, Qty)
>> Error in plot(Date, Qty) : object 'Date' not found

> You need to tell R where to find them, since they aren't R objects.
> (You can see all the actual objects with ls().)
> Two of the many options:
> with(demand, plot(Qty, Date))
> plot(demand$Qty, demand$Date)

does it help to tell R that there is a header row in the file? demand<-read.delim("path\\demand.txt", header=TRUE)

if you want to address Qty and Date directly you could attach (other options were given above)
plot(Qty, Date)
should work


______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Fri 27 May 2011 - 19:16:04 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

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 27 May 2011 - 19:40:10 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive