Displaying 20 results from an estimated 10000 matches similar to: "Date operations"
2004 Mar 05
3
as.POSIXct problem
Hi all,
I'm having difficulty converting a 'dates' object to a POSIXct object:
testDATES<-c(35947,35971,36004,36008,36053,36066)
testDATES<-chron(dates=testDATES, format = c(dates = "m/d/y"),
origin=c(month = 12, day = 30, year = 1899))
>[1] 06/01/98 06/25/98 07/28/98 08/01/98 09/15/98 09/28/98
> as.POSIXct(testDATES)
[1] NA NA NA NA NA NA
2004 Apr 02
2
How canI convert date-time to Julian date?
Hello!!
I need some help! I tried everything, but nothing worked!
I have a vector c with dates in it, in the format "2004-04-01" and i need to
convert it in the form
"04/01/2004" or "01/04/2004" !
How can i do that??
Thanks
Bye Martina
--
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
2003 Dec 04
5
Processing calendar dates with R
I am a beginner in R with a background in SAS.
Are there built-in R methods of reading dates for calculating elapsed days
between two calendar dates? If so, are there any examples I can browse?
Thanks in anticipation.
John Byrne.
Lecturer in Information Systems.
Australian Catholic University.
2005 May 11
2
time zones, daylight saving etc.
Hi, I have a whole bunch of data, which looks like:
15/03/2003 10:20 1
15/03/2003 10:21 0
15/03/2003 12:02 0
16/03/2003 06:10 0
16/03/2003 06:20 0.5
16/03/2003 06:30 0
16/03/2003 06:40 0
16/03/2003 06:50 0
18/03/2003 20:10 0.5
etc. (times given on a 24 hour clock)
and goes on for years. I have some code:
2002 Feb 13
2
formatting date strings
Hi all
I am a relatively new R user so please excuse this question if it has been
covered some where else, just tell me where to find it.
I have a simulation model that out puts dates in a standard dd/mm/yy format
R reads this as a factor and I cant find anything that will allow me to
convert them to a date. In S+ I have used a chron() function that required
you to specify the format of the
2004 Apr 29
1
Entering times around the start of daylight savings time
I'm having problems entering dates and times around when daylight savings time
starts. If I type (on R 1.8.1 on Gentoo Linux)
> ISOdatetime(2004,4,4,0:4,0,0,"GMT")
[1] "2004-04-03 19:00:00 EST" "2004-04-03 20:00:00 EST"
[3] "2004-04-03 22:00:00 EST" "2004-04-03 22:00:00 EST"
[5] "2004-04-03 23:00:00 EST"
Giving the times
2007 Sep 18
5
Need help on "date"
Dear all,
I have a variable 'x' like that:
> x
[1] "2005-09-01"
Here, 2005 represents year, 09 month and 01 day.
Now I want to create three variables naming: y, m, and d such that:
y = 2005
m = 09
d = 01
can anyone tell me how to do that?
Regards,
[[alternative HTML version deleted]]
2007 Jul 31
1
POSIXct Formating Error (PR#9819)
To Whom It May Concern:
The following appears to be a bug in the way POSIXct dates are formated.
The example is forced, but occurs naturally when importing Excel type dates
(where fractional part is fraction of a day) and small rounding errors
result.
As shown, looking at the POSIXct class, it looks as if both times are
16:11:03 (truncation)
Looking at as.numeric.POSIXct, it looks as if
2009 Sep 17
3
Simple as.Date question dealing with a timezone offset
I've been trying to understand the as.Date functionality and I have a date
and time stamp field that looks like this:
"Tue Sep 15 09:22:09 -0600 2009"
and I need to turn it into an R Date object for analysis.
Simple date conversions I have down, no problem:
> adate = c("7/30/1959")
> as.Date(adate,"%m/%d/%Y")
[1] "1959-07-30"
>
But when it
2020 Apr 04
5
Help useRs to use R's own Time/Date objects more efficiently
This is mostly a RFC [but *not* about the many extra packages, please..]:
Noticing to my chagrin how my students work in a project,
googling for R code and cut'n'pasting stuff together, accumulating
this and that package on the way all just for simple daily time series
(though with partly missing parts),
using chron, zoo, lubridate, ... all for things that are very
easy in base R *IF*
2003 Jul 31
4
timezones
I have some questions and comments on timezones.
Problem 1.
# get current time in current time zone
> (now <- Sys.time())
[1] "2003-07-29 18:23:58 Eastern Daylight Time"
# convert this to GMT
> (now.gmt <- as.POSIXlt(now,tz="GMT"))
[1] "2003-07-29 22:23:58 GMT"
# take difference
> now-now.gmt
Time difference of -5 hours
Note that the difference
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
2005 Aug 02
1
cut.Date functionality for chron date/time objects
Hello,
I've encountered the need to cut some chron objects of the form:
R> mychron <- chron(sort(runif(10, 0, 10)))
R> mychron
[1] (01/01/70 16:36:20) (01/02/70 00:08:46) (01/03/70 16:54:49)
[4] (01/04/70 06:45:00) (01/07/70 06:21:24) (01/07/70 18:28:44)
[7] (01/08/70 00:47:05) (01/08/70 05:11:44) (01/10/70 01:07:53)
[10] (01/10/70 17:46:53)
into arbitrary (e.g. a given number
2007 Mar 19
3
R4.1: seq.POSIXt, tz="AEST" (PR#9572)
Times from seq.POSIXt come out wrong in AEST timezone around Feb 29 every
leap year before 1970 (on Windows XP).
According to help(DateTimeClasses), this is handled by "our own C code".
> x <- as.POSIXct("1968-02-27") # tz="AEST"
> x.gmt <- as.POSIXct("1968-02-27", tz="GMT")
> data.frame(
GMT=seq(x.gmt, by="day",
2003 Oct 17
7
datetime data and plotting
If I take the following simple data:
YEAR MONTH DAY WEIGHT.KG
2003 10 6 1.2
2003 10 12 1.2
2003 10 16 1.3
and format the date data and plot it:
dates <- strptime(paste(DAY,MONTH,YEAR),"%d%m%Y")
plot(c(min(dates),max(dates)),c(0,max(WEIGHT.KG)),
xlab="Date",ylab="Weight (kg)",type="n")
lines(dates,WEIGHT.KG)
points(dates,WEIGHT.KG)
I find that the
2005 Feb 10
3
question about sorting POSIXt vector
Dear useRs,
How come the first attempt to sort a POSIXt vector fails (Error:
non-atomic type in greater), while the second succeeds? (Code inserted
below.) The documentation says that POSIXt is used to allow operations
such as subtraction, so I'd expect sorting to work. Is this perhaps an
OS issue? (I run R 2.0.1 on Win xp.)
Thank you,
b.
#------------code
test <- c("2005-02-08
2011 Jul 13
2
plotting date data over couple of months
Hi .. i am a beginner in R
I have data in the format of
date
04/27/11
04/27/11
04/30/11
04/30/11
05/03/11
05/03/11
05/04/11....
Now i want to plot the data something like this on x-axis...
------------------
27 28 29 30 1 2 3 4
April May
I also wanted to know how to place a "*" when a date is missing from the
data..
my
2004 May 26
3
is.weekend() odd behaviour
It seems is.weekend() is unsure ?
# Start R 1.9.0 with --vanilla on windows xp
# load package chron
> table(is.weekend(sapply(1:100, function(i){Sys.sleep(0.05);Sys.time()})))
FALSE TRUE
68 32
> date()
[1] "Wed May 26 11:18:56 2004"
> version _
platform i386-pc-mingw32
arch i386
os mingw32
system i386, mingw32
2014 Jul 09
4
Conversion date a numeric y vuelta a date
Hola a todos:
Debe de ser una tonterĂa, pero no consigo saber porque la siguiente linea
no devuelve la fecha actual:
as.Date(as.numeric(Sys.time()))
He hecho esa prueba porque no consigo pasar un numero convertido a partir
de una fecha y modificado a fecha de nuevo.
Gracias por adelantado.
Un saludo,
Alberto.
[[alternative HTML version deleted]]