Displaying 20 results from an estimated 7000 matches similar to: "as.POSIX (PR#2222)"
2002 Oct 29
1
documentation for require (PR#2226)
Full_Name: alec stephenson
Version: 1.6.0
OS: linux
Submission from: (NULL) (148.88.138.5)
The documentation for the function require is incorrect.
The file library.Rd has in its arguments section
\item{quietly}{a logical. If \code{TRUE}, a warning will not be
printed if the package cannot be found.}
which is incorrect, as a warning message is always given if the package
is not
2006 Jul 14
2
chron vs. POSIX
Hi,
One of the big decisions when writing code is how to handle dates and
times. Gabor Grothendieck provided an excellent overview of the issue in
his R News 4/1 (2004) article, and many users and developers are probably
using it as a guide. The proposed guideline is to use the simplest class
required; as Gabor put it "use Date if possible, otherwise use chron, and
otherwise use
2003 Feb 21
1
POSIX problem in New Zealand (PR#2570)
Full_Name: Arni Magnusson
Version: 1.6.2
OS: Windows XP
Submission from: (NULL) (210.48.49.68)
Hi there. I'm experiencing unexpected behaviour from as.POSIXct:
> as.POSIXct("1969-12-24")
[1] "1969-12-23 23:00:00 New Zealand Standard Time"
> as.POSIXlt("1969-12-24")
[1] "1969-12-24"
> as.POSIXlt("1969-12-24")+1
[1] "1969-12-23
2012 Jun 15
2
time zones and the chron to POSIXct conversion
Hey R folks,
i found some strange (to me) behaviour with chron to POSIXct conversion.
The two lines of code result in two different results, on ewith the
correct time zone, one without:
library(chron)
as.POSIXct(chron('12/12/2000'), tz = 'UTC')
as.POSIXlt(chron('12/12/2000'), tz = 'UTC')
Only the code below would give me a POSIXct object with the correct time
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
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
2004 Jun 14
4
Quirks with system.time and simulations
I tried the code that Richard O'Keefe posted last week, to wit:
library(chron)
ymd.to.POSIXlt <-
function (y, m, d) as.POSIXlt(chron(julian(y=y, x=m, d=d)))
n <- 100000
y <- sample(1970:2004, n, replace=TRUE)
m <- sample(1:12, n, replace=TRUE)
d <- sample(1:28, n, replace=TRUE)
system.time(ymd.to.POSIXlt(y, m, d))
[1] 8.78 0.10
2007 Apr 05
1
Extent of time zone vulerability for POSIX date and time classes
Hi.
I frequently convert date and time data to and from character
representations. I'm frustrated with chron, because 'seconds' are
required to create a time object (my input data never has seconds).
More importantly, I cannot make chron print the format 12/30/2006 (which
my output data requires).
I really like the format flexibility of strftime() and strptime(), but
of course
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
2011 May 24
2
Extracting day of month from Date objects
I've always found the chron library to be useful for
tasks like this:
> x <- round(runif(10)*100000, digits=0)
> y <- as.Date(x, origin="1970-01-01")
> library(chron)
> days(y)
[1] 7 25 26 25 10 24 1 31 12 8
31 Levels: 1 < 2 < 3 < 4 < 5 < 6 < 7 < 8 < 9 < 10 < 11 < 12 < 13 < ... < 31
Notice that it returns the days as
2004 Aug 19
5
column names in data.frame
Dear R-help,
Please can someone explain how to put a column name on an output data.frame.
##Starting with a data.frame with 3 columns (d$Year, d$NoIndiv, d$wtd_tl)
yr_ind <- split (d$NoIndiv, d$Year)
yr_tl <- split (d$wtd_tl, d$Year)
ann_ind <- sapply (yr_ind, sum)
ann_tl <- sapply (yr_tl, sum)
av_tl <- ann_tl/ann_ind
d2<- data.frame (av_tl)
##This gives me a data.frame
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.
>
2012 Jan 03
4
Changing X axis of ggplot
Thanks to Joshua Wiley for turning me on to ggplot2.
I am making a plot using this:
p <- ggplot(dallas, aes(x = offense_hour)) + geom_bar() + coord_polar()
Dallas is a data frame, and offense_hour is a column with chron
objects from the chron library. In this case, the chron object was
created with the times function. It is only a time (H:M:S) with no
date attached.
The plot shows up fine,
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,
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,
2004 Aug 19
3
probability histogram question
Hello, all;
I get an unexpected result when trying to plot a probability histogram
with R1.9.1 on windows xp:
#with the following code:
> x <- runif(100,0,1)
> hist(x)
> hist(x, freq=F)
> h <- hist(x, freq=F)
> summary(h)
# Length Class Mode
#breaks 11 -none- numeric
#counts 10 -none- numeric
#intensities 10 -none- numeric
#density 10
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 May 19
2
POSIX to ts and back to POSIX
I am trying to use POSIX datetime objects rather than chron datetime
objects but am having difficulty with POSIX in a time series. My
question: Once a POSIXct vector is bound to a time series, is there a
function to convert back to POSIXct? The following code demonstrates
what I am trying to do.
> ts(as.POSIXct(strptime(tmp,"%m/%d/%Y %H:%M:%S")),freq=1440)
Time Series:
Start =
2010 Apr 30
1
Possible bug in POSIX classes for R 2.11.0?
To the R development team;
I found an unusual behavior in zoo when I upgraded to R 2.11.0 - it abruptly terminated when I performed certain operations on large zoo objects. I sent an e-mail to Achim Zeileis and he said this was a potential bug that I should report to the R development team. The details are given below in the thread below. Basically, I can crash R with this code:
library(zoo)