get name for use in coxph in R language -


I have more than 100 metabolites and some confidential datasets like age, gender, BMI. Now I want to test each single metabolites together with sophists with coxph in a for loop.

My problem is the formula and I feel like how can I include metabolite names in the formula? received () works but gives me expression only get (x) . When I only use X, I got an error message "Variable lengths differ" .

Here is an example code:

  x   

The result is:

  rho chisq p get (x) -0.06279 6.22e-01 0.4302 SEX-0.07272 7.5 9-01 0.3838 Age -0.02007 6.01e-02 0.8064 BMI 0.01479 3.02e-02 0.8620   

If I do this more than 100 times then I Can not differentiate between get (x) in the result file

instead of "meta1" or "mate 88" instead of "get (x) Should be the way.

I thought it might be cleaner, but it's about the same < Pre> #sample data dd & lt; -data.frame (a = 1: 10, b = rnorm (10), c = runif (10), y = rpois (10,5)) #get column as the proper "name" element of the x < - lapply (for names (dd) [- ncol], as.name # formula lapply (x, function (v) lm (bquote (y. (V)), dd to include names in # Use Cloth.

Here I use lm to create a run-worthy example This should be similar to any model that uses a formula Your call looks more

  coxph (bquote (surv (age, fup_alter, hyper) ~. (X) + age + SEX + BMI), data = data,)   

Where bquote surrounds the entire formula and then Use . (X) to enter "name" elemennt in the form. In my example, there is a list of x , so let me call it lapply Need to do it again.

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -