Displaying 20 results from an estimated 10000 matches similar to: "time zones and the chron to POSIXct conversion"
2003 Nov 12
3
Chron, as.POSIXct problem
Dear R list,
I noticed the following 'problem' when changing the format of dates 
created with seq.dates() (from the Chron library) using as.POSIXct() 
(R 1.8.0 on OSX 10.2.8):
>  datesTest<-seq.dates(from="10/01/1952", length=3, by="days");
>  datesTest
[1] 10/01/52 10/02/52 10/03/52
# Now changing the format to show year as 1952.
> 
2004 Jul 07
1
question about seq.dates from chron vs. as.POSIXct
Dear R People:
Here is an interesting question:
>library(chron)
>xt <- seq.dates(from="01/01/2004",by="days",length=5)
>xt
[1] 01/01/04 01/02/04 01/03/04 01/04/04 01/05/04
>
#Fine so far
>as.POSIXct(xt)
[1] "2003-12-31 18:00:00 Central Standard Time"
[2] "2004-01-01 18:00:00 Central Standard Time"
[3] "2004-01-02 18:00:00 Central
2009 Jul 20
1
Problem with as.POSIXct on dates object
Dear R-helpers,
I have a problem converting an object made with the 'chron' function
to a POSIXct object:
# Make date based on DOY
dat <- chron(dates=232, origin.=c(month=1, day=1, year=2008))
dat
#[1] 08/20/08
# Converting to POSIXct uses current timezone (Sydney):
as.POSIXct(dat)
#[1] "2008-08-20 10:00:00 EST"
# Setting GMT timezone has no effect?
as.POSIXct(dat,
2008 Aug 01
1
chron objects: input/output
Hi list, I have some questions regarding
1) conversion of date + time characters to chron
2) formatting chron object printing
Regarding (1), Gabor's Rnews 2004 4/1 article has been indispensible,
but I often work with files where dates and times are contained in a
single field. In this case, I would like to control input/output of
chron objects when each observation of date and time is
2009 Jan 04
1
POSIXct and chron issues with tz
Dear All-
I am trying to merge two data files - they have different date formats 
and different times zones.  I need to match up the date/time of the 
datasets and then invoke a conditional statement, such as: if dataC$mph 
is >= 12 then keep dataM$co23 for the corresponding time/date stamp.
snippets of data files:
*dataC.txt*
 LST   in     mph    Deg   DegF  DegF2    %    volts   Deg   
2011 Aug 30
3
having trouble extracting week from chron object
Running R 2.13.1 on Windows XP.
I would like to get week of the year (1-52) for each date.
library(chron)
dts <- dates(c("02/27/92", "02/27/92", "01/14/92","02/28/92", "02/01/92"))
dts
dts.chron <- as.chron(dts)
dts.chron
class(dts.chron)
# all of these component extractions work:
months(dts.chron)
weekdays(dts.chron)
years(dts.chron)
2010 Jun 29
3
formating chron date times for printing
the date were created with chron with this argument
format=c(dates="Y/m/d", times="H:M:S"))
so I have the dates being displayed as
(10/06/22 12:00:00)
I would like to have them displayed as
"2010-06-22 12:00:00" or "%Y-%m-%d %H:%M:%S"
and then I can convert these for mergeing with another data frame
x <- (structure(c(14464, 14464.0104166667,
2009 Dec 01
4
median for time data
Hi everybody
How do I do to calculate the median and average of a colum of time data like
this: "8:50:10". I also need to plot the time difference between two colums
Thanks a lot
-- 
View this message in context: http://n4.nabble.com/median-for-time-data-tp932287p932287.html
Sent from the R help mailing list archive at Nabble.com.
2011 Apr 06
1
Problem to convert date to number
Hi R users,
I have a maybe small problem which I cannot solve by myself.
I want to convert 
"chron" "dates" "times"
(04/30/06 11:35:00)
to a number with as.POSIXct.
The Problem is that I can't choose different timezones. I always get "CEST"
and not "UTC" what I need.  
date = as.POSIXct(y,tz="UTC")
"2006-04-30 11:35:00
2004 Mar 01
6
Find out the day of week for a chron object?
I know that this is correct:
    library(chron)
    x = dates("01-03-04", format="d-m-y", out.format="day mon year")
    print(x)
It gives me the string "01 Mar 2004" which is correct.
I also know that I can say:
    print(day.of.week(3,1,2004))
in which case he says 1, for today is monday.
My question is: How do I combine these two!? :-) I have a
2004 Aug 18
1
Fwd: strptime() problem? - Resolved
Hi Gabor and everybody;
Thanks Gabor, with the alternative step you've told me the problem is 
resolved. Comparing the two procedures:
Extract from the source 'character' data:
> rain$ts[2039:2046]
[1] "25/03/2000 22:00:00 UTC" "25/03/2000 23:00:00 UTC"
[3] "26/03/2000 00:00:00 UTC" "26/03/2000 01:00:00 UTC"
[5] "26/03/2000 02:00:00
2010 Oct 19
4
Chron object in time series plot
Dear R users, I have the following script to create bins of specified time
intervals
bin_end=60/bin_size
bin_size=bin_size*100
h=seq(070000,180000,by=10000)
breaks=c()
for (i in h)
	{
	for (j in 0:(bin_end-1))
		{
		value=i+(bin_size)*j
		breaks=append(breaks,value)
		}
	}
I would like to plot then using the time as x-axis. I tried the following
prova=zoo(myseries,times(breaks))
but of
2011 Mar 08
1
Date arithmetic coerces POSIXlt to POSIXct?
Hi. This feels like a bug to me, or at least an undocumented feature,
but I thought I'd see what people here thought of it. Consider a POSIXlt
object like this one:
 
> a <- as.POSIXlt ("2011-01-23 12:45:45")
> class (a)
[1] "POSIXlt" "POSIXt" 
 
Fine. Now, if I do some arithmetic on that object, the result is
converted to POSIXct.
 
> class (a
2006 Nov 27
2
as.Date: conversion pb from POSIXct (PR#9386)
Full_Name: Xiao Gang FAN
Version: 2.4.0
OS: Windows
Submission from: (NULL) (159.50.101.9)
> library(chron)
> as.Date(as.POSIXct(strptime("1994-01-24","%Y-%m-%d")))
[1] "1994-01-23"
2012 Jun 08
3
day of the year for chron objects
Hi!
Is not there an standard R function to retrieve the day of the year
(since 1st Jan of the same year)?
I know I can make my own using julian, but find it weird that having
days(), months() etc doy() does not exist as an standard function.
Also, is the following not a bit inconsistent?
> a <- chron("20100506",format="ymd")
> a
[1] 100506
> years(a)
[1] 2010
2004 Aug 17
3
Fwd: strptime() problem?
Hi all;
I've already send a similar e-mail to the list and Prof. Brian Ripley 
answered me but my doubts remain unresolved. Thanks for the clarification, 
but perhaps I wasn't clear enough in posting my questions.
I've got a postgres database which I read into R. The first column is
Timestamp with timezone, and my data are already in UTC format. An 'printed' 
extract of R
2002 Feb 02
1
chron problem: extracting days and years
Hello r-help,
I'm trying to split a character vector of dates of the form "dd-mmm-yy" 
into component days, months and years. But
 > library(chron)
 > testdate<-as.POSIXlt(strptime("17-Sep-98","%d-%b-%y"))
 > testdate
[1] "1998-09-17"
 > months(testdate)
[1] "September"    # which is fine, but for days and years I get
 >
2003 Sep 17
3
Using POSIX?t rather than "chron" or "date"
The problem with POSIXt is that you must consider timezones 
and daylight vs.  standard time issues even if you don't want 
to.  This violates modularity (viz. your routines becomes coupled 
to unrelated information) and leads to subtle errors where different 
routines are assuming different time zones.
The problem is that the time, date, day of the week, month, etc. 
of a date depend on its
2003 Dec 15
3
Julian Dates
Hi,
I'm a bit confused how julian() works.  If I understand right, it returns 
the number of days since the origin. 
I have a vector:
> SLDATX[1:10]
 [1] "1986-01-06" "1986-01-17" "1986-02-02" "1986-02-04"
 [5] "1986-02-04" "1986-02-21" "1986-03-06" "1986-03-25"
 [9] "1986-04-06"
2010 Dec 16
5
test whether all elements of a vector are identical
Dear list,
this might be an easy one, but I could figure out a solution (or how to 
google the right term).
Is there any way to test whether all elements of a vector are identical?
For numeric vectors I would use
sum(diff(vector)==0)==0
but I have character vectors. Any Ideas?
Cheers
Jannis