similar to: formatting date strings

Displaying 20 results from an estimated 8000 matches similar to: "formatting date strings"

2004 Nov 08
2
Converting strings to date
Hello, I have the following problem: test is a data frame with 9 fields. The field test$Date is factorized with dates. The format is dd-mm-yyyy (using Oracle notation). I want to convert this to Date in '%Y-%m-%d format. What I am doing is: for (i in 1:nrow(test)) { test[i,]$Data<-strptime(substring(test[i,]$Data,1,10),"%d-%m-%Y") } test is a data frame. The error is:
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",
2007 Jan 04
2
Seek general information about time/date storage and functions in R
Hello R List - I have to import Excel files (either as .csv files or using RODBC) into R (2.4.1, Windows) and operate on dates and times (e.g. find minutes between times, change dates to days of week or analyze by weeks of year). The help files for format.Date, strptime, as.POSIX, DateTimeClasses, etc. etc. are informative but perhaps a little terse. I have googled unsuccessfully for a more
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
2011 Oct 05
2
any way to convert back to DateTime class when "accidental" conversion to numeric?
Hi, In short, I would like to know if there is any way to convert a numeric into a date, similar to how strptime() can convert a string to a date time class? There are some functions, etc. which don't work well with dates, and tend to force them into numerics. I understand that the number it spits back is the number of seconds since the beginning of 1970 (see the first few sentences
2003 Oct 20
1
controling x-labels in xyplot (lattice) when x is POSIX object
Hi, V1.8.0 seems to allow DateTimeClasses as the x argument in xyplots (lattice). For example: x <- seq.POSIXt(strptime("2003/01/01", format = "%Y/%m/%d"), strptime("2003/10/01", format = "%Y/%m/%d"), by = "month") y <- rnorm(length(x)) dat <- data.frame(x= x, y = y) xyplot(y ~ x, data = dat, type = "b")
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.
2006 May 30
3
Time rather than dates?
Using strptime() and other functions for dates has been very helpful with the kind of data I often work with. However, I haven't found out how time as such should be specified. All my attempts result in time *and* date: >treatment_time<-c("01:02:03","02:03:04") # hours:minutes:seconds >time.2<-strptime(treatment_time,format="%H:%M:%S") >time.2 [1]
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
2007 Feb 01
3
Extracting part of date variable
Dear all, Suppose I have a date variable: c = "99/05/12" I want to extract the parts of this date like month number, year and day. I can do it in SPSS. Is it possible to do this in R as well? Rgd, --------------------------------- Here’s a new way to find what you're looking for - Yahoo! Answers [[alternative HTML version deleted]]
2009 Mar 24
2
two different date formats in the same variable
How does one convert to a date format when survey respondents have used two different date formats whilst entering their data. There were clearly told to use mm/dd/yyyy but humans being humans some entered mm/dd/yy. There was even validity checks on the forms but I allowed them to be overridden since the data is more holy than the format. The data was downloaded as a csv and read.csv was used to
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
2013 Feb 19
3
calculating seconds
Dear R People: I'm looking at some data which has the time in seconds since 1992/10/8, 15:15:42.5 Are there any functions currently available to "translate" this or should I just do my own? I figured that I'd check first. Thanks, Erin -- Erin Hodgess Associate Professor Department of Computer and Mathematical Sciences University of Houston - Downtown mailto:
2005 Oct 18
1
Re : Seperate timestamp data into date and time
Dear R list, I am reading in text file data prepared in Access database by someone. One of the field contains timestamp data, how can I separate the timestamp data into two varaibles: date and time. Can I specify the field is in timestamp format when I first reading in ? My reading in data are as below: 449 LWT 22/10/2003 15:43:00 441 143 449 LWT 17/11/2003 15:25:00 421 169 449 LWT
2005 Feb 10
3
question about sorting POSIXt vector
Dear useRs, How come the first attempt to sort a POSIXt vector fails (Error: non-atomic type in greater), while the second succeeds? (Code inserted below.) The documentation says that POSIXt is used to allow operations such as subtraction, so I'd expect sorting to work. Is this perhaps an OS issue? (I run R 2.0.1 on Win xp.) Thank you, b. #------------code test <- c("2005-02-08
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
2009 Sep 13
2
zoo plot: yearly marks on X-Axis
On Sun, 2009-07-26 at 13:17 +0200, Poersching wrote: > stvienna wiener schrieb: > > Hi all, > > > > I am plotting a financial time series, but I need a more detailed X-Axis. > > > > Example: > > x <- zoo(rnorm(1:6000), as.Date("1992-11-11")+c(1:6000)) > > plot(x) > > > > The X-Axis is labeled "1995", "2000"
2005 Feb 28
2
Problems with downloading
Hello I'm using your program R in a course I'm taking at the University of Oslo, and thereby I need to download it to my PC. Unfortunately I do have some problems, I do not know whish files to download and how I do it. Can you please send me a list of what to download and a like where to find it? Thanks a lot, best regards Maria Befring Hovda PhD-student Norconserv AS, Seafood
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
2011 Jul 13
2
plotting date data over couple of months
Hi .. i am a beginner in R I have data in the format of date 04/27/11 04/27/11 04/30/11 04/30/11 05/03/11 05/03/11 05/04/11.... Now i want to plot the data something like this on x-axis... ------------------ 27 28 29 30 1 2 3 4 April May I also wanted to know how to place a "*" when a date is missing from the data.. my