PhD
Civil Protection - Marche Region
Meteo Section
Snow Section
Via del Colle Ameno 5
60126 Torrette di Ancona, Ancona
Uff: 071 806 7743
E-mail: stefano.so...@regione.marche.it
---Oo-oO
Date: Sat, 2 Nov 2019 21:25:09 -0500
From:
To:
Subject: [R] transforming dates
Message-ID: <
On 2019-11-03 17:04, Peter Dalgaard wrote:
On 3 Nov 2019, at 21:22 , David Winsemius wrote:
On 11/3/19 11:51 AM, Bert Gunter wrote:
===
Hey, that's my birthday! Err, no it isn't... ;-)
Is that November 3 of 2019 or March 19 of 2011 or 11 March 2019?
[please excuse the typ
On 2019-11-03 17:04, Peter Dalgaard wrote:
On 3 Nov 2019, at 21:22 , David Winsemius wrote:
On 11/3/19 11:51 AM, Bert Gunter wrote:
===
Hey, that's my birthday! Err, no it isn't... ;-)
Is that November 11 of 2019 or March 19 of 2011 or 11 March 2019?
The English sti
> On 3 Nov 2019, at 21:22 , David Winsemius wrote:
>
>
> On 11/3/19 11:51 AM, Bert Gunter wrote:
===
Hey, that's my birthday! Err, no it isn't... ;-)
--
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone:
Yes, indeed.
Thanks, David.
Cheers,
Bert
On Sun, Nov 3, 2019 at 12:22 PM David Winsemius
wrote:
>
> On 11/3/19 11:51 AM, Bert Gunter wrote:
> > Rui is right -- lubridate functionality and robustness is better -- but
> > just for fun, here is a simple function, poorly named reformat(), that
> >
On 11/3/19 11:51 AM, Bert Gunter wrote:
Rui is right -- lubridate functionality and robustness is better -- but
just for fun, here is a simple function, poorly named reformat(), that
splits up the date formats, cleans them up and standardizes them a bit, and
spits them back out with a sep chara
Rui is right -- lubridate functionality and robustness is better -- but
just for fun, here is a simple function, poorly named reformat(), that
splits up the date formats, cleans them up and standardizes them a bit, and
spits them back out with a sep character of your choice (your original
split and
Hello,
I believe the simplest is to use package lubridate. Its functions try
several formats until either one is right or none fits the data.
x <- c('11/7/2016', '14-07-16')
lubridate::dmy(x)
#[1] "2016-07-11" "2016-07-14"
The order dmy must be the same for all vector elements, if not
y <-
Well, one way to do it is via regex's -- no splitting and recombining
needed.
Note: This will convert a factor into a character vector.
> z <- c("11/7/2016", "14-07-16")
> z <- gsub("-([[:digit:]]{2})-([[:digit:]]{2})", "/\\1/20\\2",z) ## /\ is
/ and \
> z
[1] "11/7/2016" "14/07/2016"
I leave it
R-Help Forum
I have a data set that contains a date field but the dates are in two
formats
11/7/2016dd/mm/
14-07-16 dd-mm-yy
How would I go about correcting this problem. Should I separate the dates,
format them , and then recombine?
Sincerely
Jeff
myFrame$year<-years(strptime(x))
On Fri, Aug 13, 2010 at 12:36 PM, Dimitri Liakhovitski
wrote:
> Hello!
>
> If I have in my data frame MyFrame a variable saved as a Date and want
> to translate it into years, I currently do it like this using "zoo":
>
> library(zoo)
> as.year <- function(x) as.nu
On Aug 13, 2010, at 3:36 PM, Dimitri Liakhovitski wrote:
Hello!
If I have in my data frame MyFrame a variable saved as a Date and want
to translate it into years, I currently do it like this using "zoo":
library(zoo)
as.year <- function(x) as.numeric(floor(as.yearmon(x)))
myFrame$year<-as.yea
You've tried:
as.numeric(format(Sys.Date(), '%Y'))
On Fri, Aug 13, 2010 at 4:36 PM, Dimitri Liakhovitski <
dimitri.liakhovit...@gmail.com> wrote:
> Hello!
>
> If I have in my data frame MyFrame a variable saved as a Date and want
> to translate it into years, I currently do it like this using "
Hello!
If I have in my data frame MyFrame a variable saved as a Date and want
to translate it into years, I currently do it like this using "zoo":
library(zoo)
as.year <- function(x) as.numeric(floor(as.yearmon(x)))
myFrame$year<-as.year(myFrame$date)
Is there a function that would do it directl
14 matches
Mail list logo