Displaying 20 results from an estimated 800 matches similar to: "Another crack at age calculations"
2003 Jun 30
1
date to age
I have files which have columns of data that look like this:
DOB
9/27/1964
...
That is, dates in month/day/year format. When variables like DOB are read
in, they are converted to factors.
So, I wrote this to convert from date to age in years:
age<-function(x)
{as.numeric(Sys.time()-strptime(as.character(x),format="%m/%d/%Y"))/365.25}
This isn't very precise or pretty, but it
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]]
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
2018 Mar 23
1
restricted cubic spline in FGR function
Dear Thomas,
I want to use evaluate effect of Age using restricted cubic form in the FGR function as
Fgr.crr <- FGR(Hist(time, event) ~ rcs(Age_years), data=dat)
It provides error. " Error in parse(text = termtext, keep.source = FALSE): .... 1: response ~ rcs(Age_years
Do I need to change any of the R code?
Regards
Amalraj Raja
The University of Aberdeen is a charity
2010 Mar 27
2
need help
Firstly my gateway 217.20.xxx.1
My ip adress 188.72.xxx.189
Sub net 255.255.255.0 this settings works on fedora 12 perfect but on
centos ubuntu freebsd or fedora core it is not working but on all this
systems i am able to use nat, i have installed linux again and again
thousands of time the given result from centos 5.4
Also as you could see there is no gateway of me on the route table
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
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
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 Jun 13
0
date_select and date validation
Hi,
I''ve put together a simple form that contains among other things a
date_select:
<%= date_select(:user, :dob, :order => [:day, :month, :year],
:start_year => 1900, :end_year => Date.today.year) %>
In my controller I have some code to create a user entity from the
parameters posted up from the form, like so:
parameters:
2001 Oct 15
0
date and chron library help...!
Dear all,
I'm not sure whether this is a bug or not... But some help would be greatly appreciated.
I have a dataframe, which I read in using read.xport (from the foriegn library) as the orginal data is in SAS format.
3 columns of this dataset are supposed to be dates, but read.xport doesn't recognise them as dates (all columns are read in as mode numeric). So I load up the date library
2012 Jan 11
2
Checking dates for entry errors
Hello Everyone,
?
I have a question about how best to check dates for?entry errors. I recently discovered that R will read?the incorrectly entered date "11/23/21931" without producing a warning or an?error message at least under some circumstances.
?
> as.Date("11/23/21931", format = "%m/%d/%Y")
[1] "2193-11-23"
> as.Date("21931-11-23")
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,
2012 Nov 06
1
pivot table
Hello,
I have a data which looks like below: Some of the patients have multiple diagnosis.
ID(200 patients) Diag (100 unique Diag-200 in general) Proc (50 uniqe Proc) DOB (200) Gender (200)
a daig1
b diag2
c diag1
I want to reformat this data to :
ID diag1 diag 2 diag 3.. diagx proc1 proc2
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]]
2007 Oct 18
0
validates_format_of date
Can someone tell me why this returns ''dob is invalid'' when dob is
''01/01/1969''?
validates_format_of :dob, :with => /[0-9]{2}.[0-9]{2}.[0-9]
{4}/, :message => ''is invalid''
I''m trying to validate a date entred into a form. I suppose there are
different ways to accomplish this, and because it doesn''t work, I''m
2004 Apr 18
0
AGI Module
Hey all,
I'm sorry to bother you with something so trivial, but I seem to
be having an issue with the Asterisk::AGI module. I am a relative
newbie with Perl so it could be a stupid syntax mistake that I missed.
It seems when I try to execute either the stream_file or the get_data
subs nothing is actually done. It doesn't seem to stream the files, but
on the console it says it played the
2009 Apr 16
0
Printing data as a narrative or form letter rather than as a table
How would one print the information in a table without having to view it as
a table? I have a dataframe with about 30 columns and 50 rows. About 7 rows
contain human subjects where something is just not right and I need to
manually work out what is going on with them and maybe even call them to
ensure we have the data correct. It is really inconvenient to view the 7
patients in a table. Instead, I
2005 Oct 31
0
Problem using reshape with missing values in idvar
Hello everybody,
I have been recently using reshape to convert "long" data to "wide"
data. Everything was going well until I reached some problematic
datasets. It has taken me a couple of weeks to finally figure out
what might be happening.
The problem is reproducible with test cases, and on two versions of R
(Windows 2.2.0 and x86-64 Fedora Core 3 R 2.2.0).
The data
2006 Jul 21
0
[Slightly OT] Need Query Help
I need to select 1 record from each client. This record has the charge
with the most severe charge type (lowest charge_type_id). How do I go
about this?
I have been using a find_by_sql query out of the client.rb that looks
like:
SELECT c.f_name AS f_name, c.l_name AS l_name, c.gender AS gender,
c.race AS race, c.dob AS dob, c.address AS address, c.city AS
city,
c.state AS
2003 Sep 30
2
subsetting a matrix
Hi,
I'm trying to take a set of rows and columns out of a matrix. I hve
been using the index aray approach. My overll matrix is X and is 179 x
65. I want to take out 4 columns and 161 rows.
Thus I made a 161 x 2 array I and filled it up with the row,col indices.
However doing,
X[ I ] gives me a vector of the extracted elements. Is there anyway I
can coerce this into a 161 x 4 matrix?