Re: [R] need some help with date

2016-08-14 Thread Jeff Newmiller
Thank you for the (not quite working) example. a) your '= "character"' bit is a bit anti-productive, since on the one hand you are indicating that a default value can be used (so omitting any argument is okay) yet the default value you are specifying is invalid. b) The origin argument is rare

Re: [R] need some help with date

2016-08-14 Thread Jim Lemon
Hi Glenn, Perhaps this will help: dateCentury<-function(x,new_century=20) { xbits<-strsplit(x,"/") long_year<-function(x,new_century) { x[3]<-ifelse(as.numeric(x[3]) <= new_century, paste(20,x[3],sep=""), paste(19,x[3],sep="")) xdate<-paste(x,collapse="/") return(xdate) } newx<-as.

Re: [R] need some help with date

2016-08-14 Thread peter dalgaard
> On 15 Aug 2016, at 00:40 , Glenn Schultz wrote: > > Here is a sample of the data that I am working with. Dates may go back as > far as 1930’s. When I use as.Date() I noticed that any data < 12/31/68 > returns as the new century. So I wrote this function below to be applied to > the data

Re: [R] need some help with date

2016-08-14 Thread David Winsemius
> On Aug 14, 2016, at 3:40 PM, Glenn Schultz wrote: > > Here is a sample of the data that I am working with. Dates may go back as > far as 1930’s. When I use as.Date() I noticed that any data < 12/31/68 > returns as the new century. So I wrote this function below to be applied to > the dat

[R] need some help with date

2016-08-14 Thread Glenn Schultz
Here is a sample of the data that I am working with. Dates may go back as far as 1930’s. When I use as.Date() I noticed that any data < 12/31/68 returns as the new century. So I wrote this function below to be applied to the data which I dput below the function. If I use the function DateCen