23 September 2015 4 1K Report

Using R for the analysis 

Risk factors are composed of two continuous variables and 5 or so factor variables with varying levels (mostly 0,1 but a couple with 0,1,2,3) 

I am doing survival analysis for a cancer project. Basically my dataset is a series of risk variables ( t stage, tumor size, age at dx, etc, the event codes (local, regional, and distant recurrences), and then the time variable (followup time). I'm using R to do the analysis (i'm a beginner) and the problem i'm having is with the univariate cox regressions. Right now i'm just entering the line of code for each variable i.e. coxph(survobj~[risk factor],data), This obviously gets very tedious doing this for all the covariates and the different types of recurrences so I figure there has to be a way to apply the function to each variable in one line of code... something like what the apply function could do but i'm not sure how to do it. The idea would be to have something like the general function coxph(survobj~x) where x is the different risk factors, and then have it spit out an object with the HR's etc. Anyone know how I would go about coding this? I tried the following code to create a formula but it spit out an error that i'm not sure how to deal with...

f

More Zach Hopkins's questions See All
Similar questions and discussions