Displaying 20 results from an estimated 700 matches similar to: "Handling dates"
2009 Aug 11
1
Passing a list object to lapply
Hello,
I'm having difficulty passing an object name to a lapply function. Can
somebody tell me the trick to make this work?
#Works
T13702 <- TRACKDATA[["13702.xls"]][["data"]]
min(unlist(lapply(list(T13702), function(x) mdy.date(x[1, 2], x[1, 1],
x[1, 3]))))
16553
#Works
d<-2
assign(paste("T",substr(names(TRACKDATA)[d],1,(nchar(names(TRACKDATA)[d]
2000 Jan 03
1
Rounding in date.mdy from library(date)
The date library contains a function date.mdy that converts a number
D to the date (month,date,year as a list) at D days after 1 Jan 1960.
This a convention that fits in with SASs.
The logic would be that the result was the date at D days after
1 Jan 1960 00:00:00 (which is a POINT in time as opposed to a date which
is an interval), so that any D with 2<=D<3 was rounded to 3 Jan 1960
and
2009 Nov 11
1
Unexpected behaviour for as.date()
Hi everyone,
I am trying to use the function as.date() from the "dates" package in R
2.10.0 to convert a character date to a Julian date, as follows:
> as.date("02-MAY-01", order="mdy") # convert May 2, 2001 to a Julian date
[1] 2May1
However, when trying to convert a character date from the year 2000 to a
Julian date, I get an <NA> instead of the
desired
2006 Jun 09
1
date.mdy in date package
I'm having a problem with output from date.mdy in the date package.
Goal: to take a long vector of dates of the form "01/22/99" and extract values month="01", day="22", year="1999".
I am providing the vector of class dates in the attached file to date.mdy:
> mdy_dates<-date.mdy(trimmed_dates)
The first few obs of the
2001 Jan 03
1
package/ date/ download problem
Colleagues
I want to download the package "date" from CRAN <http://cran.r-
project.org/> to get the R-scripts (for version 1.2.0)
*** date/INDEX ***
as.date Coerce Data to Dates
date.ddmmmyy Format a Julian date
date.mdy Convert from Julian Dates to Month, Day, and Year
date.mmddyy Format a Julian date
date.mmddyyyy Format a Julian date
date.object Date Objects
mdy.date
2011 Sep 08
1
Seasonal and 11-day subset for zoo object
I have a zooreg object and I want to be able to generate a value for seasons
and 11-day composites paste it onto my zoo data frame, along with year,
month and days.
Right now I have the following to work from:
eg. dat.zoo.mdy <- with(month.day.year(time(dat.zoo)), cbind(dat.zoo, year,
month, day, quarter = (month - 1) %/% 3 + 1, dow =
as.numeric(format(time(dat.zoo), "%w"))))
For
2002 Feb 07
1
Plotting on log scale using plot.date()
Hi, I'm trying to use the date library and I think I'm getting an
incorrect warning when I make a plot with plot.date(). For example:
> library(date)
> x <- as.date(1:100)
> y <- 1:100
> plot(x, y, log = "y")
Warning message:
parameter "log" couldn't be set in high-level plot() function
The problem appears to be in the last line of plot.date()
2000 Apr 26
1
xaxp with dates
Dear friends.
As promised ver 1.01 solved the former problem and now dates plot OK in
windows. But.
In the following code, "cex.axis"=0.5 works OK but "xaxp"=c(14620,14680,4)
has seemingly no effect. The limits for xaxp was found from the default
plot and inspecting par(). I need to put the date marks at specific points.
Could I suppress them altogether and make a new xaxis
2024 Jun 09
2
Format
HI all,
My
I am trying to convert character date (mm/dd/yy) to YYYY-mm-dd date
format in one of the columns of my data file.
The first few lines of the data file looks like as follow
head(Atest,10);dim(Atest)
ddate
1 19/08/21
2 30/04/18
3 28/08/21
4 11/10/21
5 07/09/21
6 15/08/21
7 03/09/21
8 23/07/18
9 17/08/20
10 23/09/20
[1] 1270076 1
I am using the following
2005 Mar 18
1
RE: problem with Dates
It seems that you have load the "survival" package
date.mdy is a function from this one.
In this function the "origin" of the time is the first day of 1970
in the base package the origin is the first day of 1960
it's very curious...
Benjamin Esterni
France
From: "Vegard Andersen" <vegard.andersen@ism.uit.no>
Subject: [R] Date conversion problem using
2010 Nov 24
3
Custom ticks on x axis when dates are involved
Hi,
I have a set of irregular time series and i want to produce a simple plot, with dates on x axis and attribute value of y axis. This is simple enough but my x axis is divided automatically by ticks every 5 years. I would like to have a tick every year at January 1st. I am not sure how i can do that - i end up with something very close to what i want, but it is clunky and not very correct. I
2004 Sep 16
2
date library and notched boxplots
I'm having problems using the date library with notched boxplots. I have separate month, day, and year columns and would like to plot the columns as a date against other variables. I have used the mdy.date(month,day,year) command before with plot(), but it doesn't seem to work with boxplot(). Instead of the dates along the x-axis, I get a list of numbers. Maybe I have the code wrong?
2005 Apr 27
2
date format
Hi,
I'm trying to convert a vector containing dates in
character format ("dd/mm/yy"): mdy.date (from date
package) seems to be able to do that, but it returns
to me a vector containing julian dates... but
negative!
for example:
16/12/03 is converted into -20470
it is because R recognizes year ../03 as 1903, instead
of 2003, but how can I do to solve this problem? (of
course, I
2005 Jul 28
1
conversion from SAS
Hi, I wonder if anybody could help me in converting
this easy SAS program into R.
(I'm still trying to do that!)
PROC IMPORT OUT= WORK.CHLA_italian
DATAFILE= "C:\Documents and
Settings\carleal\My
Documents\REBECCA\stat\sas\All&nutrients.xls"
DBMS=EXCEL2000 REPLACE;
GETNAMES=YES;
RUN;
data chla_italian;
set chla_italian;
2012 Jun 15
2
How to convert month-day-year to Julian data number?
Hello,
I am trying to convert calendar dates (Month, Day, Year) into Julian Days
Product code Bureau of Meteorology station number Month Day Year Date_mdy Date
4102001 70014 1 1 1939 1/01/1939 1/01/1939
4102001 70014 1 2 1939 1/02/1939 2/01/1939
4102001 70014 1 3 1939 1/03/1939 3/01/1939
4102001 70014 1 4 1939 1/04/1939 4/01/1939
4102001 70014 1 5 1939 1/05/1939 5/01/1939
4102001 70014 1 6
2003 May 22
1
Re: dates in chron package, split warning message
>
> > Dear All,
> >
> > I am currently using R for windows.
> >
> > I am wondering why the dates command in chron package does not work in
the
> > following situation:
> >
> > cut(dates(c(23,45,67),origin=c(1,1,2004)),"months")
> >
> > but will work for:
> >
> >
2004 Oct 11
5
read "4-jan-02" as date
Dear R users,
I have a column with dates (character) in a data frame:
12-Jan-01 11-Jan-01 10-Jan-01 9-Jan-01 8-Jan-01 5-Jan-01
and I need to convert them to (Julian) dates so that I can
sort the whole data frame by date. I thought it would be
very simple, but after checking the documentation and the
list I still don't have something that works.
1. as.Date returns the error below. What am I
2000 Apr 05
1
problem with survexp in survival5
survexp in survival5 doesn't seem to work for me. see below:
> library(survival5)
Attaching Package "package:survival5":
The following object(s) are masked from package:base :
sort.list
> library(chron)
> data(ratetables)
> survexp(~ratetable(year=julian(6,1,1991),
+ sex=1,age=35*365.24),times=(0:30)/6*365.24)
Error in as.character(as.date(c(min(R[, 3]),
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:
>
2002 Apr 19
1
R and OS X
> Dears users,
> I'm trying to run R on a computer with OS X. I installed the R folder
> and the dylibs, where they must be installed. I updated my path, and
> R runs but tells me :
>
> dyld: /usr/local/R-1.4.0/lib/R/bin/R.bin version mismatch for
> library: /usr/lib/libz.1.dylib (compatibility version of user: 1.1.3
> greater than library's version: 1.0.0)