Displaying 20 results from an estimated 11000 matches similar to: "Changing x-axis when dealing with time"
2011 May 11
1
selecting data from table with timestamp
Hi,
I am using read.table to get this data that has a timestamp. The data is
for many days, but I only want to run the code I wrote only for specific
day/days/times. I canĀ“t figure out how to select a timeframe from the
list.
I have tried using subset() and didn't work
I then used:
* timestamp[for(timestamp==as.character("2011-03-15 00:00:00" ) |
2006 Jun 23
2
problem with hist() for 'times' objects from 'chron' package
Hello dear useRs and wizaRds,
I encountered the following problem using the hist() method for the
'times' classes
from package 'chron'. You should be able to recreate it using the code:
library(chron)
# pasted from chron help file (?chron)
dts <- dates(c("02/27/92", "02/27/92", "01/14/92", "02/28/92",
"02/01/92"))
class(dts)
2005 Jun 01
2
problem with chron scales in lattice
I can't get the scales parameter in xyplot of lattice to work as I
expected. I'm using R-2.1.0 and lattice 0.11-8. There should be year
labels from 1992 to 2004 for the x axis in the plot below, but instead
only a few of them appear, and in the wrong spots, as if the coordinate
system has changed after finishing with the panel function.
library(chron)
library(lattice)
# vertical grid
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
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
2008 Nov 04
2
ggplot & annotating charts
Dear "R-listers"
I've been trying to figure out how to annotate charts in ggplot (ie add text
to line charts, highlighted boxes etc). By and large, I can get close to
what i want with base graphics, but would ideally like to use ggplot
whenever possible (additionally, i would like to add text labels
automatically to the chart). The code is below
I suspect I need to use geom_rect,
2005 Jun 14
2
Dateticks
Hello. I am having the worst time converting x-axis date ticks to real
dates. I have tried several suggestions in online help tips and books to
no avail.
For example, the x-axis has 0, 50, 100, etc, and I want it to have
"6/17/03", "8/6/03" etc. See attached (sample).
Can anybody help me with this.
Here's my code:
ts.plot(date.attackmode.table[,1],
2006 Nov 08
10
axis command and excel time format
Hi to all,
I have some problems to get the times-scale to the x-axis the times are
coming from an excel sheet f. e
[1] "0:01:00" "0:02:00" "0:03:00" "0:04:00" "0:05:00" "0:06:00" "0:07:00"
[8] "0:08:00" "0:09:00" "0:10:00" "0:11:00" "0:12:00" "0:13:00"
2005 Nov 15
1
origin and "origin<-" functions on chron
I'm trying to use/modify some code I found (at Omegahat, but I've seem similar usage elsewhere.)
It contains the lines:
if(any(origin(chronDate)!=orig))
origin(chronDate) <- orig
Let's say:
> require("chron")
[1] TRUE
> chronDate <- chron("11/15/2005", format="m/d/y", origin.=c(12,31,1899))
> orig <- c(month=12, day=31,
2005 Nov 16
1
COM dates (was origin and "origin<-" in chron)
I was just looking for an easy way to convert between COM datetime and
chron datetime (both ways.)
I found examples on the list, but they involved origin.
Does anyone have functions for converting COM datetime <-> chron
datetimethat work "safely"?
David L. Reiner
> -----Original Message-----
> From: Gabor Grothendieck [mailto:ggrothendieck@gmail.com]
>
2003 Dec 06
3
Axe time of series in format yy-mm-dd
I'm trying to plot a ibm stock time series.
I made the download of that series,
ibm <- get.hist.quote(instrument = "ibm", start = "2003-01-01",quote=c("CL"))
And ibm is a serie wiht this characteristic:
Start = 37623
End = 37960
Frequency = 1
When I try to plot it,
ts.plot(ibm)
In the graphic the axe time is represented by 37623 ... 37960, How can I put
2012 Feb 17
6
convert zoo object to "standard" R object so I can plot and output to csv file
Another newbie question
I got the 1 minute spine interpolation and 15 mean aggregation working with
many thanks to Gabor Grothendieck using Zoo functions. I got a tip from
Hasan Diwan to look at xts but it seemed I would make better progress using
code from Gabor.
Now I'm having trouble plotting this zoo object. I'm thinking I want a
function to "split" the zoo object back to
2005 Jul 17
1
Where to learn how to deal with time class variable?
Dear R-helpers,
In my data set, I have a time variable 'RecordTime'
whose class property is 'times'. When I list my data
set, I see the values of RecordTime is like 10:20:30
in a 'h:m:s' format. Suppose I want to choose all the
data after 10 o'clock, then use
subset(data,RecordTime>10:20:30)
just doesn't work. I noticed that all the values of
RecordTime seem
2010 Oct 06
4
problem with abline
Hi All,
I am running a scatter plot and trying to add a best fit line. I use an abline function, but get no line drawn over the points. I also get no error. I arm using V 2.10.0 on Windows 7.
Here is my code, including the SAS transport file import:
require (foreign)
require (chron)
require (Hmisc)
require (lattice)
clin <- sasxport.get("y:\\temp\\subset.xpt")
attach(clin)
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,
2006 Dec 27
4
axis and times() problem
Dear R-Group,
the first example is working as expected, but I need the plot without
the box,
normally no problem, but I am not able to get the x-axis formatted as
times with the axis, command.
I tried a lot of things, nothing was working so I used the most easy
axis command in the second example here ....
# working
library(chron) # for times()
library(graphics)# for axis
2006 Dec 27
4
axis and times() problem
Dear R-Group,
the first example is working as expected, but I need the plot without
the box,
normally no problem, but I am not able to get the x-axis formatted as
times with the axis, command.
I tried a lot of things, nothing was working so I used the most easy
axis command in the second example here ....
# working
library(chron) # for times()
library(graphics)# for axis
2011 Oct 27
2
Simple time series question with zoo
New user here. My goal is pull daily averages from a long dataset.
I've been working with some code I got from this list from
https://stat.ethz.ch/pipermail/r-help/2009-March/191302.html
The code how I have been using it is as follows:
library(zoo)
library(chron)
DB<-read.table("/Users/me/Desktop/R/data.csv", sep=",", header=TRUE, as.is
=TRUE)
z<-zoo(LTER6$temp,
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)
2003 Nov 11
4
HMisc describe -- error with dates
Hello,
I am trying to use HMisc describe on a data frame. I have specified certain
variables as dates using, for example:
df1$aidsdate <- dates(aidsdate,format="day.mon.year", origin=c(month = 1,
day = 1, year = 1960))
When I use describe on the dataframe I get this error:
Error in Ops.dates(weights, x) : * not defined for chron objects
Has anyone had this problem? I had