[R] coordinates from locator function in POSIXct format
David Winsemius
dwinsemius at comcast.net
Fri Jul 29 18:32:34 CEST 2011
On Jul 29, 2011, at 12:21 PM, cristabel.duran wrote:
> Hi Janis,
> thank you for you answer.
>
> Actually already I did exactly what you said. However, when I
> convert the number of "seconds" from the first measurement (some day
> in July 2010) then a I get a date in the year 2050 which is
> impossible. The latest date possible is 29March2011.
>
> my value in ?seconds?: 1285038419
> z <- 1285038419
> as.POSIXct(z, origin="2010-07-15")
> "2051-04-04 03:06:59 CEST"
>
> any clue why I get this date?
Because the default origin is 1970-01-01
> z <- 1285038419
> as.POSIXct(z, origin="1970-01-01")
[1] "2010-09-21 04:06:59 EDT"
--
David.
>
> I thank your help,
>
> Cristabel.
>
>
>
> On 07/29/2011 04:45 PM, Jannis wrote:
>> Well,if you would have had a look at ?POSIXct the documentation
>> would have given
>> you quite a comprehensive explanation of the meaning of the values
>> of your time vector as they are the values these POSIXct values are
>> actually stored in (they are seconds since 1970-01-01).
>> Additionally you would have been redirected to as.POSIXct() which
>> converts all sorts of objects to POSIXct. I would expect this
>> function to return your desired format if you feed it with the
>> numeric values that locator() returned.
>>
>>
>> HTH
>> Jannis
>>
>>
>>
>> On 07/29/2011 03:40 PM, 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.
>>
>
> ______________________________________________
> 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.
David Winsemius, MD
West Hartford, CT
More information about the R-help
mailing list