[R] Raw epoch time from XTS
Joshua Wiley
jwiley.psych at gmail.com
Sat Aug 20 10:03:47 CEST 2011
Hi Noah,
This is one of those cases where following the posting guide
(particularly the minimal, reproducible example part) would have
really helped. Are you saying that calling:
xcoredata(your_xts_object) does not give you the internal
representation of time that you want?
data(sample_matrix)
sample.xts <- as.xts(sample_matrix, descr='my new xts object')
# returns a list, the index is the numeric representation of time
displayed in the rows
xcoredata(sample.xts)
You could also try the more direct:
attr(xts_object, "index")
If this is not what you want or is not working for you, providing us
the output of dput() from the first few rows of your dataset and an
example of what you do want would be spectacular.
Cheers,
Josh
On Sat, Aug 20, 2011 at 12:44 AM, Noah Silverman <noahsilverman at ucla.edu> wrote:
> Hi,
>
> I have a very large data set stored as an xts object.
>
> xts is very nice about showing row labels as "human readable" dates and times.
>
> I want the actual epoch values that are stored internally. The only way I can find to access them is one-at-a-time using the internal function: xcoredata()
>
> Calling this in an entire column, the "R" way doesn't work. It will only return a single value. Calling it in a loop for each row works but is painfully slow.
>
> Since the epoch is stored internally, there must be some way to just grab it as a vector. Does anyone know how?
>
> Thanks!
>
> --
> Noah Silverman
> UCLA Department of Statistics
> 8117 Math Sciences Building
> Los Angeles, CA 90095
>
> ______________________________________________
> 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.
>
--
Joshua Wiley
Ph.D. Student, Health Psychology
Programmer Analyst II, ATS Statistical Consulting Group
University of California, Los Angeles
https://joshuawiley.com/
More information about the R-help
mailing list