Displaying 20 results from an estimated 20000 matches similar to: "Some questions about chron package.."
2012 Nov 27
2
Books for fully understanding internal logics on some packages(quantmod, xts, zoo and chron)
Hello,
I'm very interested in using financial time series data, but I'm a beginner of R programming.
I'd like to fully understand internal logics on several time-series related packages such as quantmod, xts, zoo, chron, etc.
So, I read some books, 'R Cookbook' and 'Art of R Programming' and another simple tutorials.
But I still can't understand grammars of the
2012 Dec 19
4
How to convert xts data into list
Hello,
How can I convert Close colume of the below xts time series data into a list of Close values ?
I'd like to plot Close values as a list.
> head(zc)
Close
(10/15/12 09:00:00) 252.40
(10/15/12 09:01:00) 253.10
(10/15/12 09:02:00) 253.15
(10/15/12 09:03:00) 253.30
(10/15/12 09:04:00) 253.25
(10/15/12 09:05:00) 253.45
I tried the below command to plot it.
2011 Jul 28
3
how to shift a chron timestamp by 6:30 hours
Dear help list,
I have a timestamp in as a chron object:
> (x <- chron(dates = c("12/02/11", "22/11/11"),
+ times = c("07:30:00", "04:00:00"),
+ format = c(dates = "d/m/y", times = "h:m:s")))
[1] (12/02/11 07:30:00) (22/11/11 04:00:00)
Now I want to shift the timestamp by 06:30 (hh:mm) backwards, to get
2013 May 01
3
Chron format question h:m not working
R 2.12.2 on Scientific Linux 6.4
#works
chron(times.="15:00:00", format=c(times="h:m:s"))
#doesn't work
chron(times.="15:00", format=c(times="h:m"))
From chron Manual:
The times format can be any permutation of "h", "m", and "s" separated
by any one non-special character. The default is "h:m:s".
what am I
2012 Jan 17
2
Which date format to choose?
R offers a bewildering array of options when it comes to representing
dates and times (e.g, as.Date, chron, strptime, zoo, etc). Can anybody
recommend a document that compares the relative merit of each method? I'm
not looking for help with any one method, but rather a guide that
describes which method is best for a particular data analysis/plotting
goal.
Thanks,
Jake
[[alternative
2011 Jan 30
4
Extract time only from POSIXlt object
How can I extract only the time component from an POSIXlt object?
For example if I try the following it still returns both the date and
time...
>as.POSIXlt(tr.date[1])
[1] "2010-10-18 21:46:53"
>as.POSIXlt(tr.date[1],"%H:%M:%S")
[1] "2010-10-18 21:46:53"
round and trunc don't help... is there an "as.Time" equivalent to as.Date
?
Thanks,
2001 Jan 11
3
Reformatting dates using chron
Hello All:
I am trying to generate a sequence of dates using library(chron). Using the following code, I got most of what I want,
dts <- seq.dates("01/02/1998", "01/10/2001", by="day")
dts <- dts[!is.weekend(dts)]
a sequence of weekdays only (no weekend dates), with first observation appearing as 01/02/98 and the last 01/10/01. But I would
2012 Dec 18
1
How to draw frequency domain plot with xts time series data
Hello,
I'd like to convert the below time-series data with fft or wavelet related function and plot it.
Could you let me know
1. How to convert xts data frame format to list format ?
2. How to plot fft or wavelet diagram ?
Here is the data :
> class(zc)
[1] "xts" "zoo"
> str(zc)
An ‘xts’ object from (10/15/12 09:00:00) to (10/15/12 15:15:00)
2002 Oct 28
1
as.POSIX (PR#2222)
Full_Name: Alec Stephenson
Version: 1.6.0
OS: linux
Submission from: (NULL) (148.88.138.5)
Appears to be a sign error in as.POSIX(lt/ct)
> library("chron")
The following is fine, with default origin.
> tmp <- chron(1:2, origin = c(1,1,1970))
> as.POSIXlt(tmp)
[1] "1970-01-02 01:00:00 GMT" "1970-01-03 01:00:00 GMT"
These are not.
> tmp <-
2012 Oct 19
1
to.yearly()
v="IBM"
library(quantmod)
v
v1=getSymbols(v)
to.yearly(v1)
===============================
when i pass the value through a variable in to.yearly() function it shows
the error msg like
"Error in try.xts(x) :
Error in UseMethod("as.xts") : no applicable method for 'as.xts' applied
to an object of class "character""
i need the result of OHLC
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)
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
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
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)
2000 Feb 16
1
chron and mysql
R 0.90.1
chron 2.2-2
MySQL 3.22.30
Attempts to create a chron object fail when using date and time data
from a mysql database. It appears that chron does not like 4 digit
years. Is this the problem?
my data look like:
> c.time[1:10,]
Date Time
1 2000-02-14 10:15:02
2 2000-02-14 10:17:03
3 2000-02-14 10:18:03
4 2000-02-14 10:19:03
5 2000-02-14 10:20:04
6 2000-02-14
2011 Sep 16
1
Mystified - comparing chron times
I have two local variables: startTime and expectedStartTime. Both are chron
related objects.
When I look at the class for the objects I can see they are of class
"times".
When I print them to the console, they both read: "09:30:00"
When I print them as.numeric(), they both read: 0.3958333
When I try and compare them: (as.numeric(startTime) ==
as.numeric(expectedStartTime)) it
2009 May 31
1
using chron vector with boxplot
Hi,
I'm having trouble using dates (created using library(chron)) as
groupings for a boxplot. I have 10 repeat measurements of a variable
within an individual day. The measurements were done over 10 days. I
would like to plot the measurements as a box and wisker plot (using
boxplot or something similar) where the days (as chron object) would be
the grouping and the repeated measurements
2012 Jun 01
1
Missing times chron
Dear all,
As a novice user of R I ran into a problem that's quite hard for me to
resolve. I have a database containing data of a clinical trial in which
patients are included that survived or died:
x <- matrix(data=c(1:5,0, "1/1/2012 00:00:00",0,0,"1/7/2012 00:00:00"),
nrow=5, ncol=2, dimnames= list(NULL,c("ID", "dateofdeath")))
My file is a .csv
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
2006 Sep 20
1
hours() in 'chron': output != input
I encountered surprising (to me, at least) behavior while using 'hours()'
in package 'chron.' I will be grateful if someone can point out my error
or provide an explanation and intuitive solution (I suppose I could
convert chron to a character vector and use substring, but I deal mostly
with newbies and kludgy approaches don't inspire much confidence).
I used 2.3.0 to