Displaying 20 results from an estimated 20000 matches similar to: "Bug in seq.date?"
2008 Sep 11
3
Truncating dates (and other date-time manipulations)
Dear all,
I've been struggling to perform common operations on dates that I need
to be able to correct draw date-time scales - in particular I need to
be able to round/truncate/ceiling dates to arbitrary precision - e.g.
to weeks, months or years (or multiples thereof). I haven't been able
to find anything to do this in base R (trunc.Date only truncates to
sub-day units), or in the date
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,
2007 Jun 13
5
Confusion with sapply
Hi,
I have some confusion in applying a function over a column.
Here's my function. I just need to shift non-March month-ends to March
month-ends. Initially I tried seq.dates, but one cannot give a negative
increment (decrement) here.
return(as.Date(seq.dates(format(xdate,"%m/%d/%Y"),by="months",len=4)[4])
)
Hence this simple function:
> mydate <-
2010 Aug 18
1
Controlling the dates in R;
Dear R gurus,
I am currently using the chron package for date manipulation in R and I
am able to control the date which take the format
- 1998/07/03, and
- 2006-09-15 (date without time)
Library(chron)
As.Date(2006-09-15, format = '%Y-%m-%d')
However I have a problem with the date containing only the year and
month (i.e. 2006-09, 2007/08, 200609).
2009 Sep 09
2
Help with data containing date
Hello Everyone,I think this is a very simple problem, I have been struggling
with it for a few days now.
I have a 10-year daily data in the following format.
Date A B C D E
1978-10-22 18 20.64 0.0 0.176 -1.76
1978-10-23 15 17.06 0.4 0.147 2.52
1978-10-24 3 7.588 0.0 0.068 -6.86
1978-10-25 9 11.491 0.0 0.102
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,
2008 Oct 01
9
time segments intersection
Hi all,
Please, how could I calculate the time that two time segments has in
common? Is there any function to perform this calculation?
For instance, given four POSIXlt objects...
endPeriod<-as.POSIXlt("2008-09-30")
startPeriod<-as.POSIXlt("2007-10-01")
endProject<-as.POSIXlt("2007-05-31")
startProject<-as.POSIXlt("2006-12-01")
that limit
2009 Jan 12
3
roll weekly data to monthly level
Dear R users:
I have a data set that looks something like this:
ID time y
1 2/01/2008 4
1 2/09/2008 12
1 9/01/2008 8
2 1/06/2008 3
2 3/01/2008 4
2 3/09/2008 9
2 6/03/2008 4
3 1/02/2008 3
3 1/10/2008 8
3 2/02/2008 7
3 2/10/2008 3
I'd like to sum up the weekly data to the monthly level, so that it looks
something
2008 Sep 22
1
as.day() Function (zoo question)
I am was going to look at the as.yearmon function in the zoo package
and write a as.day function to aggregate a time series of 96
observations per day into the mean for each day, but I don't know how
to look at the code so that I can convert it into something I can use.
On top of that I believe that it is probably an S3 method and I
haven't quite gotten that far in my programming
2009 Oct 07
1
Formatting outputs:(chronological object)
Hello everyone,
I have a data generated in a way similar to the following
library(chron);library(zoo)
date<- seq(as.Date("1990-01-01"),, as.Date("2000-12-31"), by = 1)
obs<- zoo(rnorm(length(date), mean = 10, sd = 2.5), order.by = date)
monthly<- function(date) as.Date(as.yearmon(Date))
result<- data.frame ( Date = obs = aggregate(obs, monthly, sum))
Now,
I want
2009 Feb 17
2
annual maximum value
hi everyone!
hope you can help me here.
i am a new R user. what i am trying to do is to find the maximum annual
discharge from a daily record. i have a data.frame which includes date and
the discharge. somewhat like this..
10/1/1989 2410
10/2/1989 2460
10/3/1989 2890
...
...
...
12/31/2005 5730
i have been browsing through the archives and fount out about the aggregate
2004 Dec 03
4
seq.Date requires by
Hi,
What is the reason for seq.Date to require the 'by' argument and not to
default it to 1 in the example below?
> seq(from=as.Date("1996-01-01"), to=as.Date("1996-12-01"))
Error in seq.Date(from = as.Date("1996-01-01"), to =
as.Date("1996-12-01")) :
exactly two of `to', `by' and `length.out' / `along.with' must be
specified
2008 Jul 25
1
plot zoo custom panel help
#the below code is the way that I would like the plot to look. I have tried
to write a panel function:
my.panel <- function(x, y, ..., pf = parent.frame()) {
axis(side=1, at = seq(rng[1], rng[2], 1/12), labels = n, tcl = -0.3)
}
#but it does not work and I am at a loss and help would be appreciated. I
will use this for multiple
library(zoo)
library(chron)
#this is what I would like the
2010 Oct 25
3
finding the year of a date
I know that I can use as.yearmon in the package "zoo" to find the year
and the month of a date.
I can use as. yearqtr to find the year and the quarter.
But how can one find just the year of a date?
Thanks a lot!
--
Dimitri Liakhovitski
Ninah Consulting
www.ninah.com
2005 Dec 19
3
given a mid-month date, get the month-end date
I have a vector of dates.
I wish to find the month end date for each.
Any suggestions?
e.g.
For 12/15/05, I want 12/31/05,
For 10/15/1995, I want 10/31/1995, etc
__________________________________________________
[[alternative HTML version deleted]]
2010 Jul 07
3
Need help in handling date
Dear all, I have a date related question. Suppose I have a character string
"March-2009", how I can convert it to a valid date object like
as.yearmon("2009-01-03") in the zoo package? Is there any possibility there?
Ans secondly is there any R function which will give the names of of all
months as "LETTERS" does?
Thanks for your time.
[[alternative HTML version
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)
2009 Mar 11
2
How to monthly,daily,yearly average
Sorry, this is my first time to post.
I have a big data set: first colume is date (ex: 2008-2-150, the second is time (10:30:00), and the following columes are variaty measurement data. Every 30 min, I have one data.
I want to find an effecient way to calculate the hourly, daily, monthly and yearly average, and plot them, and eventually use these average data to do further analysis.
Thanks!
2010 Jul 10
7
Need help on date calculation
Hi all, please see my code:
> library(zoo)
> a <- as.yearmon("March-2010", "%B-%Y")
> b <- as.yearmon("May-2010", "%B-%Y")
>
> nn <- (b-a)*12 # number of months in between them
> nn
[1] 2
> as.integer(nn)
[1] 1
What is the correct way to find the number of months between "a" and "b",
still
2009 Sep 22
3
how to convert character string with only month and year into date
Dear R helpers.
I am new to plotting time data using R.
wonder how to convert character time info into date in R.
I searched over the web but did not find answer.
the input character string is something like 03_1993 or 03-1993, so the
precision is at month level. I tried the following but failed.
#R code below.
strptime(c("03_1993"),"%m_%Y")