Displaying 20 results from an estimated 10000 matches similar to: "Date vs date (long)"
2007 Sep 14
2
Date vs date
I wrote the date package long ago, and it has been useful. In my current task
of reunifying the R (Tom Lumley) and Splus (me) code trees for survival, I'm
removing the explicit dependence on 'date' objects from the expected survival
routines so that they better integrate. Comparison of 'date' to 'Date' has
raised a couple of questions.
Clearly Date is more
2005 May 26
2
warnings from hist(): parameter XXX couldn't be set in high-level plot functionN
Hello -
This is not a real problem, just an annoyance. Sometimes, but not always,
I get a set of strange warnings from hist(). Example follows.
############################
#Produce a histogram of start dates for a set of field measurements.
# I didn't reproduce all the dates, because not sure it's relevant, but
here's a sample.
# Note the invalid date in the fifth element.
>
2006 Feb 21
3
Number of Days Between Dates: Incorrect Results For Date Calucations.
In some cases, incorrect results are produced by the code below intended to
calculate the number of days between 2 dates. The year in question was a
leap year.
Note the results for 2004-04-04 and 2004-04-05 are the same! They should be
37 and 38 respectively.
> as.integer(as.POSIXct("2004-04-02") - as.POSIXct("2004-02-27"))
[1] 35
>
2011 Apr 22
1
histogram of dates
I can't seem to get a histogram of dates:
tmt910% R --vanilla
R version 2.13.0 (2011-04-13)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
...
> temp <- as.Date(1:200, origin="1970/01/01")
> range(temp)
[1] "1970-01-02" "1970-07-20"
> hist(temp)
Error in .Internal(inherits(x, what, which)) : 'x' is missing
2010 Oct 29
7
date calculation
Hi list,
Could someone explain to me why the following result is not a integer?
> difftime(strptime("24NOV2004", format="%d%b%Y"), strptime("13MAY2004",
>format="%d%b%Y"), units="days")
Time difference of 195.0417 days
I'm using R2.12.0 on WinXP.
Thanks!
...Tao
2005 Nov 23
3
date/time arithmetic
On the help page "DateTimeClasses {base}" it says:
"One can add or subtract a number of seconds or a difftime object
from a date-time object, but not add two date-time objects."
However,
> x<-Sys.time(); y<-Sys.time()+3600
> diff<-y-x
> x; y; diff
[1] "2005-11-23 19:58:20 GMT"
[1] "2005-11-23 20:58:20 GMT"
Time difference of 1 hours
2009 Jan 21
3
Error as.Date on Invalid Dates
Hi All,
I have an script in R which accepts user inputs for certain parameters,
particularly dates, which the user inputs as character strings.
eg:
> date1 <- "2009-01-21"
The script later parses the input via the as.Date function:
> as.Date(date1)
However, as.Date encounters an error when the string does not represent an
actual date.
eg:
> date1 <-
2012 Mar 19
1
diff(time) vs. difftime?
I just encountered another RTFM problem: With
diff(as.POSIXct(...), ...) I was unable to control the units of the
results. Examples:
> (d.d <- diff(as.POSIXct(c('2012-12-12', '2012-12-13'))))
Time difference of 1 days
> (d.h <- diff(as.POSIXct(c('2012-12-12 08:00', '2012-12-12 09:00'))))
Time difference of 1 hours
> (d.m <-
2008 Jun 25
1
Incompatible methods ("+.Date", "Ops.difftime") for "+"
I received a warning about incompatible methods that I don't understand.
The workaround in this example is simple.
What is the reason that these methods are seen as incompatible?
Is there some dangerous consequence of my as.numeric() workaround?
Can a fix to the code base, perhaps similar to my workaround, make this
warning no longer necessary?
I am using R 2.7.0 on Windows.
version.string R
2002 Feb 28
1
Bug in julian() (PR#1332)
Full_Name: Michael Jacob
Version: 1.4.1
OS: Windows 2000 SP2
Submission from: (NULL) (195.27.237.226)
Hi,
there seems to be a bug in julian():
> Sys.getlocale()
[1] "LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
States.1252;LC_MONETARY=C;LC_NUMERIC=C;LC_TIME=English_United States.1252"
> julian(Sys.time())
Error in fromchar(x) : character string is not in a
2008 Dec 02
3
date operations
Un texte encapsul? et encod? dans un jeu de caract?res inconnu a ?t? nettoy?...
Nom : non disponible
URL : <https://stat.ethz.ch/pipermail/r-help/attachments/20081202/10f66fc6/attachment.pl>
2004 Aug 19
2
proposed change to [.POSIXct
R developers,
The "tzone" attribute is stripped from a POSIXct object when the subscript
command is called ("[.POISXct"). This results in dates being printed in the
locale specific format after a subscript operation is applied to a POSIXct
object which has cause several problems for me in the past.
Here is an example of this problem under R 1.9.1:
> x <-
2008 Apr 11
1
Error in fromchar(as.character(x)) : character string is not in a standard unambiguous format
Hello,
I was hoping for advice regarding resolving the above error.
I have a csv file that contains the following variable:
$ Order.Made.Date : Factor w/ 299 levels
"1-Apr-08","1-Aug-05",..: 278 285 91 286 159 132 108 261 282 147 ...
I want to calculate a variable named F.length, which is today's date
minus the values contained in the variable:
2011 Jul 19
2
strange problem with strptime and date variable
Hello all,
I am manipulating a large database with 70,000 records. "strptime" generates
a date variable but R treats some of the values as NA. I attach a simple
example below.
I have spent hours on this problem. Any hint would be greatly appreciated.
Many thanks,
Edwin Sun
# =======start of sample code =============
> x <- c("2005-04-02 19:03:00", "2005-04-03
2010 Sep 02
2
date
Hello all,
I've 2 strings that representing the start and end values of a date and
time.
For example,
time1 <- c("21/04/2005","23/05/2005","11/04/2005")
time2 <- c("15/07/2009", "03/06/2008", "15/10/2005")
as.difftime(time1,time2)
Time differences in secs
[1] NA NA NA
attr(,"tzone")
[1] ""
How can i
2010 May 14
2
Add 1 week to date with hours included for subset
Forum,
I've got hourly data for roughly 5 months of time that I want to subset into
successive weeks. The first two elements of the dataset are
well.80.2$date[1]
>[1] 6/12/2000 2:00
>9256 Levels: 10/1/2001...
well.80.2$date[2]
>[1] 6/12/2000 3:00
>9256 Levels: 10/1/2001....
and so on until mid-october. I've been able to add 1 week the first element
with the following:
2009 Mar 18
1
time difference (from date function)
Dear all,
I have two variables which contents are date() function answers, like:
d1<-date()
d2<-date()
Now I need to compute the difference between d2 and d1 (in minutes).
Any help are welcome.
Best wishes
miltinho
brazil
[[alternative HTML version deleted]]
2009 Nov 02
3
question about difference in date objects
Hi R Community:
I want to take the difference in two dates:
dt2 - dt1.
But, I want the answer in months between those 2 dates.
Can you advise me?
Please respond to: pzs6 at cdc.gov
Thank you!
Phil Smith
Centers for Disease Control and Prevention
2011 Mar 14
4
Serial Date
Hello R Help,
I'm working in a project with a software that register date and time data in serial time format. This format is used by excel, for exemple. In this format, 40597.3911423958 is 2011/2/23 09:23:15. First part is number os days since 1900/1/1, and second part is a fraction of a day.
I need to make this transformation in R, and use it to make some algebrian operations. I found that
2009 Jun 10
2
isolating Hour and minute form date and time
Hi everybody. I have a dataframe that contains a factor with the date
information in the format like in the example below:
"2009/05/12 11:22:31 AM"
I have been able to convert it to POSIXt using strptime
Now I want to print only the date as one vector and the time in another
vector but they must be real date and time classes so that i can use them in
calculations
to reconstruct my