Re: [R] date conversion problem

2020-08-13 Thread Abdoulaye Sarr
Hi Jim, Thanks for the hint, that makes sense and I'll arrange accordingly. Best regards, Abdoulaye On Thu, Aug 13, 2020 at 8:38 AM Jim Lemon wrote: > Hi Abdoulaye, > It looks to me as though your offsets are in hours, not days. You can > get a rough date like this: > > time<-c(1569072,1569096,

Re: [R] date conversion problem

2020-08-13 Thread Jim Lemon
Hi Abdoulaye, It looks to me as though your offsets are in hours, not days. You can get a rough date like this: time<-c(1569072,1569096,1569120,1569144, 1569168,1569192,1569216,1569240) time_d<-as.Date("1800-01-01")+time/24 time_d [1] "1979-01-01" "1979-01-02" "1979-01-03" "1979-01-04" "1979-01-0

[R] date conversion problem

2020-08-13 Thread Abdoulaye Sarr
I have dataset with time sine 1800-01-01 and extracted data from 1981 to 2019 and used these lines for the data conversion: > time_d <- as.Date(time, format="%j", origin=as.Date("1800-01-01")) > time_years <- format(time_d, "%Y") > time_months <- format(time_d, "%m") > time_year_months <- format(ti

Re: [R] Date Conversion Problem

2020-08-12 Thread Eric Berger
nice On Wed, Aug 12, 2020 at 6:18 PM Bert Gunter wrote: > Extra packages are not needed. > > My question is: why change the character representation at all? See the > format argument of ?as.Date. > > > as.Date("20010102",format="%Y%m%d") > [1] "2001-01-02" ## the default format for the print me

Re: [R] Date Conversion Problem

2020-08-12 Thread Bert Gunter
Extra packages are not needed. My question is: why change the character representation at all? See the format argument of ?as.Date. > as.Date("20010102",format="%Y%m%d") [1] "2001-01-02" ## the default format for the print method for Date objects Bert Gunter "The trouble with having an open m

Re: [R] Date Conversion Problem

2020-08-12 Thread Eric Berger
library(lubridate) a <- "20200403" lubridate::ymd(a) # 2020-04-03 HTH, Eric On Wed, Aug 12, 2020 at 5:57 PM Stephen P. Molnar wrote: > i have written an R script which allow me to plot the number of Covid-10 > cases reported by he state of Ohio. In that se t of data the date format > is in the

[R] Date Conversion Problem

2020-08-12 Thread Stephen P. Molnar
i have written an R script which allow me to plot the number of Covid-10 cases reported by he state of Ohio. In that se t of data the date format is in the form -mm-dd. My script uses: datebreaks <- seq(as.Date("2020-01-01"), as.Date("2020-08-10"), by="1 week") . .

Re: [R] date conversion

2011-03-18 Thread Joshua Wiley
Hi Patrick, On Fri, Mar 18, 2011 at 12:17 PM, Patrick Connolly wrote: > On Wed, 16-Mar-2011 at 07:58PM -0700, Joshua Wiley wrote: > |> ## A small example is always nice > |> dat <- ts(1:12, frequency = 12, > |>   start = c(1998, 1), end = c(2010, 12)) > |> > |> ## Achim and Gabor's wonderful pack

Re: [R] date conversion

2011-03-18 Thread Patrick Connolly
On Wed, 16-Mar-2011 at 07:58PM -0700, Joshua Wiley wrote: |> Hi Erin, |> |> I am not sure what a "seq.Date object" is. My first thought is that |> you are talking about the date method for seq(), but there are |> hundreds of packages I do not know. In any case, here is what I think |> you want.

Re: [R] date conversion

2011-03-16 Thread David Winsemius
On Mar 16, 2011, at 10:22 PM, Erin Hodgess wrote: Dear R People: I have a monthly time series which runs from January 1998 to December 2010. When I use tsp I get the following: tsp(ibm$ts) [1] 1998.000 2010.917 12.000 Is there an easy way to convert this to a seq.Date object, please

Re: [R] date conversion

2011-03-16 Thread Gabor Grothendieck
On Wed, Mar 16, 2011 at 10:22 PM, Erin Hodgess wrote: > Dear R People: > > I have a monthly time series which runs from January 1998 to December 2010. > > When I use tsp I get the following: > >> tsp(ibm$ts) > [1] 1998.000 2010.917   12.000 > > > Is there an easy way to convert this to a seq.Date

Re: [R] date conversion

2011-03-16 Thread Joshua Wiley
Hi Erin, I am not sure what a "seq.Date object" is. My first thought is that you are talking about the date method for seq(), but there are hundreds of packages I do not know. In any case, here is what I think you want. Josh ## A small example is always nice dat <- ts(1:12, frequency = 12, s

[R] date conversion

2011-03-16 Thread Erin Hodgess
Dear R People: I have a monthly time series which runs from January 1998 to December 2010. When I use tsp I get the following: > tsp(ibm$ts) [1] 1998.000 2010.917 12.000 Is there an easy way to convert this to a seq.Date object, please? I would like to have something to the effect of 1998/0

Re: [R] date conversion and plot

2010-11-08 Thread Hans-Joachim Müller
Good morning, try this: #your date format datum<-c("100907","101008","101109") #convert it (works with and without as.Date) datum<-as.Date(strptime(datum,("%y%m%d"))) plot(datum,5:7) I hope it works for you Hajo Am 09.11.2010 06:37, schrieb sachinthaka.abeyward...@allianz.com.au: > Hi All, > >

[R] date conversion and plot

2010-11-08 Thread sachinthaka . abeywardana
Hi All, I have a date in the format of yymmdd (without any of the backslashes, eg. 100731). How do I convert this into a Rdate and plot it? I don't want the number of days from 1970's showing up as my date (Its the date I require). Thanks, Sachin p.s. sorry about the corporate notice I can't rem

Re: [R] date conversion

2010-09-03 Thread Joshua Wiley
Hi, I think you just need to add the format = argument. Does this help? > x <- factor("01-11-2007") > as.character(x) [1] "01-11-2007" > as.Date(as.character(x), format = "%d-%m-%Y") [1] "2007-11-01" Cheers, Josh On Fri, Sep 3, 2010 at 2:11 PM, André de Boer wrote: > > Hello, > > I have a da

[R] date conversion

2010-09-03 Thread André de Boer
Hello, I have a dataframe with data such as: > dat$BEGINDATUM[3] [1] 13-09-2007 > dat$BEGINDATUM[4] [1] 01-11-2007 > class(dat$BEGINDATUM[3]) [1] "factor" Now I need to make calculation with these dates. But I get these result: > as.date(as.character(dat$BEGINDATUM[3])) [1] > as.date(as.charact

Re: [R] Date conversion

2010-08-04 Thread Gabor Grothendieck
On Wed, Aug 4, 2010 at 8:33 PM, Steven Kang wrote: > Hi all, > > I am trying to convert all the dates (all days that are not Friday) in data > frame into dates to next Friday. > > The following works but the result is returned as vector rather than the > original class. > > It would be greatly app

[R] Date conversion

2010-08-04 Thread Steven Kang
Hi all, I am trying to convert all the dates (all days that are not Friday) in data frame into dates to next Friday. The following works but the result is returned as vector rather than the original class. It would be greatly apprecited if you could provide any solution to this problem. Many th

Re: [R] Date conversion

2010-06-11 Thread Felipe Carrillo
a Wiley > To: Felipe Carrillo > Cc: r-h...@stat.math.ethz.ch > Sent: Thu, June 10, 2010 1:18:27 PM > Subject: Re: [R] Date conversion > > Hello Felipe, Is this what you want? format(as.Date("3/10/10", > format="%m/%d/%y"), "%B %d, %Y") Josh O

Re: [R] Date conversion

2010-06-10 Thread Joshua Wiley
Hello Felipe, Is this what you want? format(as.Date("3/10/10", format="%m/%d/%y"), "%B %d, %Y") Josh On Thu, Jun 10, 2010 at 8:29 AM, Felipe Carrillo wrote: > Hi: > Can't find a way to convert from shortDate to LongDate format. I got: > 3/10/10 that I want to convert to March 10, 2010. I am us

[R] Date conversion

2010-06-10 Thread Felipe Carrillo
Hi: Can't find a way to convert from shortDate to LongDate format. I got: 3/10/10 that I want to convert to March 10, 2010. I am using: \documentclass[11pt]{article} \usepackage{longtable,verbatim} \usepackage{ctable} \usepackage{datetime} \title{my title} \begin{document}   % Convert date \dd

Re: [R] Date conversion issue

2010-03-18 Thread ManInMoon
Thanks - that works -- View this message in context: http://n4.nabble.com/Date-conversion-issue-tp1596548p1597627.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/

Re: [R] Date conversion issue

2010-03-17 Thread Henrique Dallazuanna
Use %y indeed of "%Y". On Wed, Mar 17, 2010 at 12:00 PM, ManInMoon wrote: > > I am parsing dates as follows: > >> z[1:10,1:3] >    V1       V2           V3 > 1    0 03/02/09 22:20:51.274 > 2  100 03/02/09 22:28:18.801 > 3  200 03/02/09 22:33:33.762 > 4  300 03/02/09 22:40:21.826 > 5  400 03/02/09

Re: [R] Date conversion issue

2010-03-17 Thread ManInMoon
Sorry -- View this message in context: http://n4.nabble.com/Date-conversion-issue-tp1596548p1596880.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE

[R] Date conversion issue

2010-03-17 Thread ManInMoon
I am parsing dates as follows: > z[1:10,1:3] V1 V2 V3 10 03/02/09 22:20:51.274 2 100 03/02/09 22:28:18.801 3 200 03/02/09 22:33:33.762 4 300 03/02/09 22:40:21.826 5 400 03/02/09 22:41:38.361 6 500 03/02/09 22:42:50.882 7 600 03/02/09 22:45:19.885 8 700 03/02/09 22:4

Re: [R] Date conversion problem

2010-03-04 Thread Don MacQueen
as.Date('17/02/2005','%d/%m/%Y') [1] "2005-02-17" (Read the documentation more carefully to distinguish between %y and %Y; I guess you tried lots of combinations but never tried the correct one, so just be more careful at matching what your data is with the format string you create.) -D

[R] Date conversion problem

2010-03-04 Thread Newbie19_02
Hi All, I have a character data.frame that contains character columns and date columns. I've manage to convert some of my character columns to a date format using as.Date(x, format="%m/%d/%y"). An example of one of my dates is PROCHIDtDeath icdcucd date_admission1 date_admission_2 CAO00

Re: [R] date conversion not as i would have expected

2009-10-21 Thread Duncan Mackay
Hi This is on WinXP with regional settings as EST (we are now on DST but I run EST) R2.9.2 x <- structure(1254351600, class = c("POSIXt", "POSIXct"), tzone = "") > x [1] "2009-10-01 09:00:00 EST" > as.POSIXlt(x) [1] "2009-10-01 09:00:00 EST" > as.Date(x, formate="%Y-%m-%d" ) [1] "2009-09-30"

[R] date conversion not as i would have expected

2009-10-21 Thread clair.crossup...@googlemail.com
Good day, i imported some data into R from Excel. By using the edit() function, this is what one of the dates looks like in R: > x <- structure(1254351600, class = c("POSIXt", "POSIXct"), tzone = "") [1] "2009-10-01 BST" However, when i do the following, the date changes: > as.Date(x, formate="

Re: [R] Date conversion

2009-03-05 Thread Pele
Hi Uwe, You are correct - that was a type O (52) and thanks for you your suggestion that works.. Pele wrote: > > > > Hi R users, > > I have a factor variable called date as shown below: Can anyone share the > best / most efficient way to extract year and week (e.g. year = 2006, > week = 52

Re: [R] Date conversion

2009-03-05 Thread Sundar Dorai-Raj
Hi, There are possibly several ways to do this. My approach would be: dates <- strptime(as.character(DATE), "%d%b%Y") year <- dates$year + 1900 week <- floor(dates$yday/365 * 52) HTH, --sundar On Thu, Mar 5, 2009 at 8:58 AM, Pele wrote: > > Hi R users, > > I have a factor variable called date

Re: [R] Date conversion

2009-03-05 Thread Uwe Ligges
Pele wrote: Hi R users, I have a factor variable called date as shown below: Can anyone share the best / most efficient way to extract year and week (e.g. year = 2006, week = 52 for first record, etc..)? My data set has 1 million records. DATE 11DEC2006 11SEP2006 01APR2007 02DEC2

[R] Date conversion

2009-03-05 Thread Pele
Hi R users, I have a factor variable called date as shown below: Can anyone share the best / most efficient way to extract year and week (e.g. year = 2006, week = 52 for first record, etc..)? My data set has 1 million records. DATE 11DEC2006 11SEP2006 01APR2007 02DEC2007 Thanks in

Re: [R] Date conversion

2008-11-13 Thread Peter Dalgaard
Dr. Alireza Zolfaghari wrote: > Hi List, > If I have a date format as: > d <- "2001/1/1" > I can easily convert it to number by using as.Date(d). Yes. If it means "January the 1st" and not "1st of January", that is... > But if I have d<-"1/1/2001", it does not work. Does anyone know how I can >

[R] Date conversion

2008-11-13 Thread Dr. Alireza Zolfaghari
Hi List, If I have a date format as: d <- "2001/1/1" I can easily convert it to number by using as.Date(d). But if I have d<-"1/1/2001", it does not work. Does anyone know how I can convert it using pre-written function in R? Regards, Alireza [[alternative HTML version deleted]] ___