similar to: Help useRs to use R's own Time/Date objects more efficiently

Displaying 20 results from an estimated 8000 matches similar to: "Help useRs to use R's own Time/Date objects more efficiently"

2020 Apr 05
0
Help useRs to use R's own Time/Date objects more efficiently
I think POSIXct and POSIXlt are badly-chosen names. The name "POSIX" implies UNIX. (i.e. XYZix operating system is mostly POSIX compliant... Woo-Hoo!). My assumption is that most people modelling industrial/econometric data etc, or data imported from databases, don't want system references everywhere. Historically, I've use the principle that: If programming language A uses
2004 Mar 01
6
Find out the day of week for a chron object?
I know that this is correct: library(chron) x = dates("01-03-04", format="d-m-y", out.format="day mon year") print(x) It gives me the string "01 Mar 2004" which is correct. I also know that I can say: print(day.of.week(3,1,2004)) in which case he says 1, for today is monday. My question is: How do I combine these two!? :-) I have a
2004 Mar 08
5
years from as.POSIXlt
Hi, how it's possible to extract the year and the number of days from Julian date. i'm little confused about the last two functions and ?years . EDATE comes from sqlQuery with as.is=T EDATE <- as.POSIXlt(datvears$ENROLLDAY) Many thanks, Christian > EDATE[1:5] [1] "2000-06-30 11:25:01" "2000-06-30 11:39:55" "2000-06-30 12:11:11" [4]
2012 Dec 06
1
Incorrect DST time changes in DateTimeClasses
Can anyone please shed any light on why R DateTimeClasses give weird times for when daylight saving time information changes, and which aren't consistent with the OS? Example: Expected result: in New Zealand DST stopped (NZDT -> NZST) at 03:00 NZDT on 2010-04-04, as confirmed by the OS time zone info (OS X 10.8.2): zdump -v /etc/localtime /etc/localtime Sat Apr 3 13:59:59 2010 UTC
2024 Oct 10
1
Typo in DateTimeClasses.Rd
Hello, When following a thread that started today [1], I read the documentation for DateTimeClasses {base} more carefully and noticed a typo in the "Details on POSIXlt" section, in the paragraph right after the components list. The original and corrected are "he" instead of "the". From earlier versions of R, he last two components will not be present for
2020 Apr 06
2
Help useRs to use R's own Time/Date objects more efficiently
> (1) Create a top-level help page with a title like "Date and Time > Classes" to give a brief but general overview. This would mean the > existing DateTimeClasses would need a new title. I wanted to modify my first suggestion. Perhaps a better idea would be to reference an external document giving an overview of the subject. I couldn't find a discussion of POSIXct/POSIXlt
2006 Aug 10
2
day, month, year functions
Hi list, I'm trying to turn a date into something productive. (Not what you may be thinking....) I want three functions so I could take a "date" object and get the day of week, month, and year from it. xx <- as.Date("2006-01-05") month(xx) equal 1 day(xx) equal 5 year(xx) equal 2006 I'm aware of the weekdays() and months() functions in the base package. But
2007 Mar 07
2
No years() function?
Hi, I'm trying to aggregate date values using the aggregate function. For example: aggregate(data,by=list(weekdays(LM),months(LM)),FUN=length) I would also like to aggregate by year but there seems to be no years() function. Should there be one? Is there any alternative choice? Also, a hours() function would be great. Any tip on this? Thanks in advance! S?rgio Nunes
2007 Mar 19
3
R4.1: seq.POSIXt, tz="AEST" (PR#9572)
Times from seq.POSIXt come out wrong in AEST timezone around Feb 29 every leap year before 1970 (on Windows XP). According to help(DateTimeClasses), this is handled by "our own C code". > x <- as.POSIXct("1968-02-27") # tz="AEST" > x.gmt <- as.POSIXct("1968-02-27", tz="GMT") > data.frame( GMT=seq(x.gmt, by="day",
2011 Mar 01
2
Does POSIXlt extract date components properly?
I would like to use POSIX classes to store dates and extract components of dates. Following the example in Spector ("Data Manipulation in R"), I create a date > mydate = as. POSIXlt('2005-4-19 7:01:00') I then successfully extract the day with the command > mydate$day [1] 19 But when I try to extract the month > mydate$mon [1] 3 it returns the wrong month. And
2011 Nov 17
2
Adding a year to existing date
Hi I need to add an year to and date field in the dataframe. Please help me X Date 1 2008-01-01 2 2008-02-01 3 2003-03-01 Thanks in advance -- View this message in context: http://r.789695.n4.nabble.com/Adding-a-year-to-existing-date-tp4078930p4078930.html Sent from the R help mailing list archive at Nabble.com.
2016 Dec 15
2
print.POSIXct doesn't seem to use tz argument, as per its example
On the documentation page for DateTimeClasses, in the Examples section, there are the following two lines: format(.leap.seconds) # the leap seconds in your time zone print(.leap.seconds, tz = "PST8PDT") # and in Seattle's The second line (using print) seems to ignore the tz argument, and prints the dates in my time zone, while: format(.leap.seconds, tz =
2007 Mar 02
2
Error in length of vector ?
Hi, I'm having a weird result with the length() function: >a [... omited ...] [9994] NA "2003-12-03 16:37:00" "2002-06-26 18:43:00" [9997] "2005-07-04 04:00:00" "2007-02-16 22:09:00" "2007-02-24 15:49:00" [10000] NA > length(LastModified) [1] 9 > length(c(LastModified)) [1] 9 I was expecting to get
2004 Nov 30
4
Unable to understand strptime() behaviour
R V2.0.1 on Windows XP. I have read the help pages on strptime() over and over, but can't understand why strptime() is producing the following results. > v <- format("2002-11-31", format="%Y-%m-%d") > v [1] "2002-11-31" > factor(v, levels=v) [1] 2002-11-31 Levels: 2002-11-31 > x <- strptime("2002-11-31",
2003 May 12
1
Zeitreihen problem
Hallo! I lese gro?e Zeitreihen in R ein z.B. mit: > disc<-read.table("F:/R/DATA/discount_rate_usa.txt") disc hat dann folgende Struktur: > disc[1:5] V1 V2 1 01/03/1955 1.5 2 01/04/1955 1.5 3 01/05/1955 1.5 4 01/06/1955 1.5 5 01/07/1955 1.5 ich will das disc als Zeitreihe erkannt wird und will z.B 01/03/1955 in ein Datum verwandeln, aber es wird als
2009 Oct 27
2
Year and Month extraction from Date object.
Hello, I have seen much discussion on Date. But I can't seem to do this simple operation. I can convert a string to a date: d <- as.Date(DATE, format="%m/%d/%Y") But what I want to do is extract the year and month so I can construct an element in a ts object. Ideally I would like to see d$year but that doesn't seem to be available. Once I have a Date object how can I get an
2004 May 06
3
strptime
Delving into the murky world of dates and times I found this: dates <- c("02/27/92", "02/27/92", "01/14/92", "02/28/92", "02/01/92") > times <- c("23:03:20", "22:29:56", "01:03:30", "18:21:03", "16:56:26") > x <- paste(dates, times) > z <- strptime(x, "%m/%d/%y
2003 Dec 04
5
Processing calendar dates with R
I am a beginner in R with a background in SAS. Are there built-in R methods of reading dates for calculating elapsed days between two calendar dates? If so, are there any examples I can browse? Thanks in anticipation. John Byrne. Lecturer in Information Systems. Australian Catholic University.
2002 Feb 22
1
Weekdays
Hello, I'm trying to write a function that returns the number of weekdays between a vector of start dates and a vector of end dates. Subtracting the 2 times the number of whole weeks is the easy part and works if the number of days is a multiple of 7. However, the number of weekend days in the tail is a little harder. It depends on both the start date of the tail and the number of days in
2005 Dec 12
2
date handling
Hi, Given a frame with calendar date's: "2005-07-01", "2005-07-02","2005-07-03","2005-07-04","2005-07-05",etc. I want to extract the following from these dates: week number month number year number Any ideas how to accomplish this? Many thanks. Regards, Richard