[R] coordinates from locator function in POSIXct format
jim holtman
jholtman at gmail.com
Fri Jul 29 19:02:58 CEST 2011
I keep the following function handy so that I can change the numeric
value from POSIXct back to POSIXct; I tend to keep the numeric in
matrices since it allows faster operations in some cases. This just
puts the appropriate classes on the object; quicker than using
as.POSIXct(z, origin="1970-01-01")
unix2POSIXct <- function (time) structure(time, class = c("POSIXt", "POSIXct"))
> z <- 1285038419
> as.POSIXct(z, origin="1970-01-01")
[1] "2010-09-21 04:06:59 EDT"
> unix2POSIXct(z)
[1] "2010-09-20 23:06:59 EDT"
>
On Fri, Jul 29, 2011 at 9:40 AM,
<cristabel.duran at waldbau.uni-freiburg.de> wrote:
> Dear R-list,
>
> I have a plot with y-axis corresponding to wind measurments
> and x-axis with date-time information.
> When I want to identify some extrem wind events in the
> wind-curve, I use locator() to get the exact
> date-information, by clicking in the points in graph I´m
> interested in.
> I get in the R console the x and y coordinates.
> The x coordinates are not in a POSIXct format, I guess R is
> returning the x coordinates in a time unit as miliseconds
> or something else.
>
> Do anyone how to get the x coordinates directly in a
> POSIXct format?
>
> Thanks in advance!
> Cristabel.
>
>
> Cristabel Durán Rangel. PhD Student.
> Institute of Silviculture. Faculty of Forest and
> Environmental Sciences. University of Freiburg.
> Germany
> Telf: +49 (761) 203 8604 (ofc)
>
> „Man lernt die Physiognomie einer Landschaft desto besser
> kennen, je genauer man die einzelnen Züge auffaßt, sie
> untereinander vergleicht und so auf dem Wege der Analysis
> den Quellen der Genüsse nachgeht, die uns das große
> Naturgemälde bietet.“
> Alexander von Humboldt, 1799
>
> ______________________________________________
> 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.
>
--
Jim Holtman
Data Munger Guru
What is the problem that you are trying to solve?
More information about the R-help
mailing list