Re: [R] Dates in R (Year Month)

2016-07-14 Thread Mangalani Peter Makananisa
2015" "Jul 2015" "Aug 2015" [8] "Sep 2015" "Oct 2015" "Nov 2015" "Dec 2015" "Jan 2016" "Feb 2016" "Mar 2016" [15] "Apr 2016" "May 2016" "Jun 2016" -

[R] Dates in R (Year Month)

2016-07-13 Thread Mangalani Peter Makananisa
Hi All, I am trying to convert the vector below to dates please assist I have tried to use information on the links you sent, but it is not working. X = c(201501, 201502, 201503, 201505, 201506, 201507, 201508, 201509, 201510, 201511, 201512, 201601, 201602, 201603, 201604, 201605, 201606) li

Re: [R] Dates in R (Year Month)

2016-07-13 Thread David L Carlson
2016" [15] "Apr 2016" "May 2016" "Jun 2016" - David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message- From: R-help [mailto:r-help-boun...@r-project.org]

Re: [R] Dates in R (Year Month)

2016-07-13 Thread Ismail SEZEN
You can not convert numeric vectors directly to yearmon object. You must convert the X variable to character and add “-“ between year and month. Then as.yearmon function will work properly. Please, read help pages of ?as.character, ?strptime and ?as.yearmon. Example: > library(zoo) > aaa <- as

Re: [R] Dates in R

2012-05-07 Thread Rui Barradas
Oops, Sorry, wrong number. x <- 20101020 as.Date(as.character(x), format="%Y%m%d") as.POSIXct(as.character(x), format="%Y%m%d") Rui Barradas -- View this message in context: http://r.789695.n4.nabble.com/Dates-in-R-tp4614266p4614756.html Sent from the R help mailing list archive at Nabble.co

Re: [R] Dates in R

2012-05-07 Thread Rui Barradas
Hello, Try x <- 20102010 as.Date(as.character(x), format="%Y%d%m") [1] "2010-10-20" as.POSIXct(as.character(x), format="%Y%d%m") [1] "2010-10-20 BST" Note that you must pass x as a character vector. If not, the date functions will see it as the number of days since an origin such as 1970-01-01

Re: [R] Dates in R

2012-05-07 Thread Uwe Ligges
On 07.05.2012 10:24, BrittD wrote: Hi everyone, I have a file in which the dates are subscribed as for instance: 20101020. This is 20th Octobre 2010. strptime("20101020", format="%Y%m%d") seems to work for me... UWe Ligges My problem is that R won't except this as a date, since there is

[R] Dates in R

2012-05-07 Thread BrittD
Hi everyone, I have a file in which the dates are subscribed as for instance: 20101020. This is 20th Octobre 2010. My problem is that R won't except this as a date, since there is no sign to seperate the Year, Month and Day and that it will only see it as an origin, which it is not. Does anyone k

Re: [R] Dates in R

2007-11-28 Thread Horace Tso
To: Horace Tso; r-help@r-project.org Subject: [R] Dates in R Hi, I have dates in the following format: 4/8/2006 (MM/DD/). I need to have R compare date A to date B to figure out which one is more recent. Is there a way to do that? Simply using the '>' or '<' sign

Re: [R] Dates in R

2007-11-28 Thread jim holtman
Convert to Date and then compare; > x <- as.Date("4/8/2006", "%m/%d/%Y") > y <- as.Date("5/10/2007", "%m/%d/%Y") > x>y [1] FALSE > On Nov 28, 2007 2:44 PM, Irina Burmenko <[EMAIL PROTECTED]> wrote: > Hi, > > I have dates in the following format: 4/8/2006 (MM/DD/). I need to have > R compar

[R] Dates in R

2007-11-28 Thread Irina Burmenko
Hi, I have dates in the following format: 4/8/2006 (MM/DD/). I need to have R compare date A to date B to figure out which one is more recent. Is there a way to do that? Simply using the '>' or '<' signs doesn't seem to work. I think in this case R treats '/' as a division sign and give