[R] Assigning "dates" attribute

JTW jack_wang2000 at yahoo.com
Thu Apr 7 17:26:41 CEST 2005


Dear List,

I have a one-column data set in .csv format.

I used read.csv to import the data into R, as follows:

x <- read.csv("data.csv", header = TRUE, sep = ",")

The data points have a 'dates' attribute, which is in
a separatel .csv file.  I used the same command as
above to import it into R.

To assoicate the 'dates' attribute with the data
points, I did:

> attributes(x)<-date

Which resulted in:

Error in "attributes<-"(`*tmp*`, value = date) :
attributes must be in a list

So then I did:

> attributes(x)<-list(date)

Again, got an error, though slightly different this
time:

Error in "attributes<-"(`*tmp*`, value = list(date)) :
attributes must be named

Any help is appreciated.




More information about the R-help mailing list