Displaying 20 results from an estimated 20000 matches similar to: "POSIXct dates on x-axis using xyplot"
2006 Apr 17
1
Tick mark alignment for POSIXct data
I am using POSIXct objects to store my date/time information. If I am
plotting less that 2 days worth of data, I get the correct tick marks on the
x-axis which is showing the 'day HH:MM' and these line up with the data
points.
If the data spans more than 2 days, the tick marks are now off. In the data
below, I am creating some sample data and plotting the points. I am in the
Eastern
2007 Aug 08
2
Error: Cannot Coerce POSIXt to POSIXct when building package
A newbie here - please forgive me if this is a basic question. We have an
in house package built in R 2.2.1 (yes we're a little behind the times at
our firm)and would like to rebuild it using R 2.5.1. However, when I try
and build the package from source, I keep getting this error:
Error in as(slotVal, slotClass, strict = FALSE) :
no method or default for coercing "POSIXt"
2011 Mar 21
1
Help with POSIXct
I rarely work with dates in R, so I know very little about the
POSIXct and POSIXlt classes. I'm importing an excel file into R using
the RODBC package, and am having issues reformatting the dates.
1. The important info:
> sessionInfo()
R version 2.12.2 (2011-02-25)
Platform: i386-pc-mingw32/i386 (32-bit)
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United
2001 Sep 19
1
X-axis with POSIXct dates
I have a series of datasets, each containing pH measurements and
manufacturing dates, and each dataset pertains to a different manufactured
product. I'm trying to create a series of plots of pH measurements by
date, but the default X-axis labeling behavior is not giving adequate
results in this particular case, and I can't figure out how to persuade R
to come up with something more
2007 Nov 01
1
daylight saving / time zone issues with as.POSIXlt/as.POSIXct (PR#10392)
Running under Windows XP 64 bit, as.POSIXlt()/as.POSIXct() seem
to think that US time zones (EST5EDT, MST7MDT) switched from daylight
savings back to standard time on Oct 28, 2007, whereas the switch
is actually on Sun Nov 04, 2007.
Examples:
> Sys.timezone()
[1] "Mountain Daylight Time"
> as.POSIXct("2007-10-30 12:38:47")
[1] "2007-10-30 12:38:47 Mountain
2008 Feb 05
1
Inconsistent lattice scales$x$at,label behaviour for POSIXct
I have encountered the following behaviour in lattice in 2.6.1 (and
2.4.0) which differs depending upon the type you use. I believe the
numeric behaviour to be correct, and the POSIXct behaviour to be in
error.
When the x data and x axis in a lattice graph are POSIXct, and when
using scales$x$at and scales$x$labels to add custom labels:
If the first visible at value is not the first
2005 Feb 09
1
Dates labels on axes in xyplot
I am a bit confused about how to get the format of the labels in xyplot
to show as dates rather than the numeric value.
e.g.,
x <- as.Date(c("20/01/2001","20/02/2003","21/06/2004"),"%d/%m/%Y")
y <- c(1,2,3)
plot(y~x) #produces formatted labels
xyplot(y~x) #doesn't give formatted x labels
2003 Sep 17
2
Date on x-axis of xyplot
xyplot doesn't seem to want to label my x-axis with dates but instead puts
the day-number for each date.
begdate is the number of days since January 1, 1960 and was initially
created by
library(date)
...
polls$begdate<-mdy.date(begmm,begdd,begyy)
I create a new dataframe (pollstack) which includes begdate. In the process
begdate seems to lose its date attribute so I redo it as:
>
2009 Dec 21
1
proposal for new axis.Date/axis.POSIXct
Hi R-devel.
I've noticed a couple of quirks in the current time/date axis
functions (axis.Date, axis.POSIXct, and the equivalents in lattice).
Looking at the code, it seems like a fairly ad-hoc approach, often
using pretty() on components of the time. This is not always ideal -
for example a one-hour interval gets cut into 10-minute chunks rather
than the more natural 15-minute chunks (since
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 May 26
2
Strange behaviour of as.POSIXct
Hi:
I do not understand the returned value of NA in the following, which is a simplified version of
my attempt to convert the start column of the data frame AirQual in the SwissAir package.
as.POSIXct(paste('04.04.2004 0',0:3,sep=''),format='%d.%m.%Y %H')
[1] "2004-04-04 00:00:00 EST" "2004-04-04 01:00:00 EST"
[3] NA
2009 Sep 14
1
dates with lattice graphics
Hi,
I'm trying to do something simple (I think) with lattice graphics. I want
to have three xyplots in a single column, where the x axis for the three is
a date range and the y axes are numeric.
I tried doing the first chart, and ran into a problem. When I enter:
xyplot (date ~ count)
I get a well formed plot with the date on the y axis, but when I enter:
xyplot (count ~ date)
I get:
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
2016 Aug 18
1
axis.POSIXct and axis.Date fail for reversed axes
When plotting a reversed time axis with the base graphics system, R
fails to label the axes.
Example:
times <- c(Sys.time() - 100, Sys.time())
plot(times, 1:2, xlim = times) # correctly labels the x-axis
plot(times, 1:2, xlim = rev(times)) # fails to label the x-axis
axis.POSIXct(1, times) # still fails to add labels
dates <- c(Sys.Date() - 10, Sys.Date())
plot(dates, 1:2, xlim = dates)
2010 Feb 05
2
lattice barchart using a time scale in x axis
I'm trying to produce a barchart plot with groups, in which each group is placed in a particular
time scale in x-axis. If I use barchart directly it does not take the time scale. I've tried with
xyplot and adding a panel.barchart, I have the bars in the right place, but not the three groups I'm
trying to produce. I've tried defining panel and panel.group, but can't get it to
2004 Apr 22
3
POSIXct vs Dates
I noticed the addition of the Dates class for dates without times, in R
1.9. I am making extensive use of POSIXct at present and would like to
know whether it is worth changing to Dates. What are a few of the
trade-offs?
Thanks,
Frank
---
Frank E Harrell Jr Professor and Chair School of Medicine
Department of Biostatistics Vanderbilt University
2009 May 11
1
inconsistent results for axis.POSIXct
Some time ago, I posted a note about what I considered to be a bug in
axis.POSIXt() for R 2.8.x, relating to whether timezones in the data are
obeyed on the axes. A link to that note, and to a quick and helpful
response, is at the following URL
http://www.nabble.com/patch-for-axis.POSIXct-%28related-to-timezones%29-td22338700.html#a22338700
Note that R 2.9.0 has been adjusted to help with
2010 Feb 01
1
Error with cut.POSIXt and daylight savings time switchover dates
The following code:
cut(as.POSIXct("2009-11-01 04:00:00", tz="America/Los_Angeles"), "1 day")
gives the error:
Error in seq.int(0, to - from, by) : 'to' must be finite
This is related to November 1st, 2009 being the switchover date from daylight savings time to standard time in the America/Los_Angeles time zone. In particular, in cut.POSIXt, the starting
2009 Mar 04
2
patch for axis.POSIXct (related to timezones)
I am finding that axis.POSIXct uses the local timezone for deciding where to
put tic marks, even if the data being plotted are in another time zone. The
solution is to use attr() to copy from the 'x' (provided as an argument) to
the 'z' (used for the 'at' locations).
I have pasted my proposed solution in section 1 below (as a diff). Then, in
section 2, I'll put some
2001 Sep 21
1
behavior of xaxt = "n" with POSIXct dates
Prof. Ripley has provided very helpful information regarding X-axis
labeling with POSIXct-class dates. Now I've run into another bit of
problematic behavior. I'm running R 1.3.0 on Windows NT 4.0.
When I create a plot with the optional argument xaxt = "n", and the X axis
is generated from dates of class POSIXct, the X axis is plotted.
Obviously, I'd like to prevent the X