[R] How to retrieve data frame column names?

Prof Brian Ripley
Tue, 13 May 2003 16:30:11 -0000

On Tue, 13 May 2003, Song, Guangchun wrote:

> Does anyone tell me how to retrieve the data frame column names?
>
> I'm working on coxph model to analyze survival data of Affy DNA chips.
>
> I get the coxph coef p-value for each probe and want output the probe name
> with the p-value.  The probe names are the data frame column names.
>
> How can I do this?

That is rather vague!  At a guess, you did

fit <- coxph(..., data=foo, ...)

and want to retrieve `foo'.  That's stored in fit$call$data.

--
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595