Displaying 2 results from an estimated 2 matches for "dobp".
Did you mean:
dob
2010 Dec 10
2
Remove 100 years from a date object
Hello,
I have some data that has dates in the form 27.02.37. I convert them to
a date object as follows:
as.Date(data$date,format="%d.%m.%y")
But this gives me years such as 2037 when I would like them to be 1937.
I thought of trying to take off some time i.e.
as.Date(camCD$DoB,format="%d.%m.%y") - 100*365
But that doesn't seem to work out correctly. Any ideas how to
2010 Dec 11
0
is there a packge or code to generate markov chains in R
...d end up with an invalid date if you have 29-Feb-2000
and 29-Feb-1900. One wasn't a leap year...
A solution minus those caveats is to convert to POSIXlt and adjust the
$year element:
> dob="27.02.37"
> as.Date(dob,format="%d.%m.%y")
[1] "2037-02-27"
> dobp = as.POSIXlt(as.Date(dob,format="%d.%m.%y"))
> dobp$year = dobp$year - 100
> dobp
[1] "1937-02-27 UTC"
> as.Date(dobp)
[1] "1937-02-27"
although it might be easier to paste a '19' into your character variable
> paste(substr(dob,1,6),"19&...