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 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