similar to: date to age

Displaying 20 results from an estimated 9000 matches similar to: "date to age"

2010 Feb 23
1
Problem with strptime generating missing values where none appear to exist
Dear R Helpers, I am having difficulty with strptime. I wish to find the differences between two vectors of times. I have apparently no difficulty to convert the vectors to the appropriate format using strptime. But, then difftime does not calculate all the differences. Here is the code and output:- dob=strptime(as.character(datx$BDT),'%d-%b-%y'); dob$year=dob$year-100
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
2008 Mar 20
3
Problem with diff(strptime(...
Hi all, I have been chipping away at a problem I encountered in calculating rates per year from a moderately large data file (46412 rows). When I ran the following command, I got obviously wrong output: interval<- c(NA,as.numeric(diff( strptime(mkdf$MEAS_DATE,"%d/%m/%Y")))/365.25) The values in MEAS_DATE looked like this: mkdf$MEAS_DATE[1:10] [1] 1/5/1962 1/5/1963
2005 Dec 18
13
calculate age based on DoB
Hi, I wrote a little helper that calulates someone''s age based on his/her date of birth. def age(dob) diff = Date.today - dob age = (diff / 365.25).floor age.to_s end It works fine, but it''s not completely accurate as it just takes the average days in a year. It should be able to calculate this more accurately, right? I can''t work it out
2011 Nov 07
2
Problem working with dates
Hello All, I've been reading books about R for awhile now and am in the process of replicating the SAS analyses from an old report. I want to be sure that I can do all the things I need to in R before using it in my daily work. So far, I've managed to read in all my data and have done some data manipulation. I'm having trouble with fixing an error in a date variable though, and was
2012 Oct 08
2
converting DOB format to age
Hi, I have a column of DOB in mm/dd/yyyy. I want to convert this format to age. Thanks a lot.   Best,Farnoosh Sheikhi [[alternative HTML version deleted]]
2012 Jul 11
3
unable to subtract dates in R
Hi, I wanted to calculate the age of people in my dataset by subtracting the individual's date of birth from their intake into a program. After several hours, searches of help archives, and the downloading of lubiridate, I have had no luck with this. Below is the code I used. > intakeDS$DOB <- as.character(intakeDS$DOB) > intakeDS$DOB <- as.Date(intakeDS$DOB,
2011 Jan 26
2
applying a set of rules to each row
All, I would like to apply a set of rules to each row of the sample data set below. The rule sets are the guidelines for determining an individual's date for retirement eligibility. The rules are found in this document, http://www.opm.gov/feddata/RetirementPaperFinal_v4.pdf. I am only interested in the top two categories for retirement eligibility, the CSRS and FERS plans. The data set has
2010 Feb 23
0
subtracting 100 from strptime year vector generates missing values in POSIXct where none appear to exist in strptime year vector
Thanks Don MacQueen for this reply to my initial query - please SEE MY REPLIES TO THESE IDEAS AND FURTHER INFORMATION BELOW >From: Don MacQueen [macq at llnl.gov] >Sent: 23 February 2010 21:25 >To: Jonathan Williams; r-help at r-project.org > >Subject: Re: [R] Problem with strptime generating missing values where none appear to exist > >What happens if you do all that NA
2006 Jan 22
23
calculate users age
i know it''s probably really simple, how do i work out someone''s age if i have their d.o.b. stored as a date in my db. cheers -- Posted via http://www.ruby-forum.com/.
2010 Oct 29
7
date calculation
Hi list, Could someone explain to me why the following result is not a integer? > difftime(strptime("24NOV2004", format="%d%b%Y"), strptime("13MAY2004", >format="%d%b%Y"), units="days") Time difference of 195.0417 days I'm using R2.12.0 on WinXP. Thanks! ...Tao
2005 Dec 20
2
Time data
Dear All, I wonder how to compute the age from the date of birth and the date of examination. Suppose that have the following data: df <- as.data.frame(rbind(c(1,"10/08/1950","15/03/1998"), c(1,"10/08/1950","20/07/1998"), c(1,"10/08/1950","23/10/1998"))) names(df) <- c("ID", "date_birth",
2011 Jul 19
2
strange problem with strptime and date variable
Hello all, I am manipulating a large database with 70,000 records. "strptime" generates a date variable but R treats some of the values as NA. I attach a simple example below. I have spent hours on this problem. Any hint would be greatly appreciated. Many thanks, Edwin Sun # =======start of sample code ============= > x <- c("2005-04-02 19:03:00", "2005-04-03
2010 Aug 16
1
How can I read date format '02-Jan-02' ?
Hello, I am trying to read a database exported from SAS. It is form of csv, and the date format reads '02-Feb-99'. I used following code to convert character to date format, db$dob<-as.Date(db$dob, format="%d-%b-%y"). but it doesn't work, only seems NA. What's wrong with this code? Thank you in advance. Best, Dong-Hee Koh [[alternative HTML version deleted]]
2002 May 31
2
error in seq.POSIXt?
I am trying to extract only the winters (defined to be 01-Dec through 28-Feb) of daily data from 1948-2002. There are 90 days in each winter season. I wrote the following code to gather the winter dates into a single vector: DJF <- NULL for(year in 1949:1999) { temp.begin <- strptime(paste("01/12", year-1, sep="/"), "%d/%m/%Y") temp.end <-
2011 Oct 25
2
difftime producing NA values in R 2.12.2
R-listers, I have noticed several posts on issues with difftime producing NA's but they have been for older versions of R. Here's the issue associated with difftime that I am dealing with in R 2.12.2. > preciptime = strptime("01/10/2007 14:00",format="%m/%d/%Y %H:%M") > class(preciptime) [1] "POSIXlt" "POSIXt" > # Now using difftime, this
2010 May 14
2
Add 1 week to date with hours included for subset
Forum, I've got hourly data for roughly 5 months of time that I want to subset into successive weeks. The first two elements of the dataset are well.80.2$date[1] >[1] 6/12/2000 2:00 >9256 Levels: 10/1/2001... well.80.2$date[2] >[1] 6/12/2000 3:00 >9256 Levels: 10/1/2001.... and so on until mid-october. I've been able to add 1 week the first element with the following:
2007 Sep 14
2
Date vs date
I wrote the date package long ago, and it has been useful. In my current task of reunifying the R (Tom Lumley) and Splus (me) code trees for survival, I'm removing the explicit dependence on 'date' objects from the expected survival routines so that they better integrate. Comparison of 'date' to 'Date' has raised a couple of questions. Clearly Date is more
2019 Nov 25
2
Restar datetime, resultado erróneo
Buenos días, Tengo una lista de programas de televisión con sus horas de inicio y me gustaría encontrar la duración de cada uno. Para ello utilizo *strptime* para convertir las horas en formato *POSIXlt *y las resto con la función *difftime* . No tengo ningún problema salvo cuando un programa comienza antes de las 12 de la noche y termina después de la medianoche. Os pongo un ejemplo: horai
2011 May 14
2
changing the day of the week in dates format
Dear all, I have a question related to the POSIXlt function in R. I have a set of dates and times, for exmaple: startx <- as.POSIXct("2011-01-01 00:00:00") finx <- as.POSIXct("2011-12-31 00:00:00") daysx<- seq(startx, finx, by="24 hours") I want to change the dates of all the days falling on a Saturday to the next working day (i.e. Monday). So I