I have the following xts objetct "temp" 
 
> str(temp)
An ‘xts’ object from 2010-12-26 to 2011-03-05 containing:
  Data: num [1:70, 1] 2.95 0.852 -0.139 1.347 2.485 ...
 - attr(*, "dimnames")=List of 2
  ..$ : NULL
  ..$ : chr "t_n"
  Indexed by objects of class: [POSIXct,POSIXt] TZ: GMT
  xts Attributes:  
 NULL


> temp
                  t_n
2010-12-26  2.9500000
2010-12-27  0.8520833
2010-12-28 -0.1390625
...........

I would like to associate another column with the day of week in the form of 
1=Mon, 2=Tue, ..., 7=Sun
in order to obtain:

>newtemp

                  t_n                     dow
2010-12-26  2.9500000    7
2010-12-27  0.8520833    1
2010-12-28 -0.1390625    2
..............

How could make this in the shortest (and elegant?) way?

Ciao from Rome
Vittorio

______________________________________________
[email protected] 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.

Reply via email to