Re: [R] retrieving object name

2006-07-10 Thread Laurent Deniau
Prof Brian Ripley wrote: > On Mon, 10 Jul 2006, Laurent Deniau wrote: > >> I have a data frame with named columns and I would like to know if it is >> possible to retrieve a column name once selected: > > > Not really. df$col1 is a new object which does not know where it came > from. > > If y

Re: [R] retrieving object name

2006-07-10 Thread Gabor Grothendieck
Use drop = FALSE. For example using builtin data frame BOD we can display the Time column with its heading: BOD[, "Time", drop = FALSE] On 7/10/06, Laurent Deniau <[EMAIL PROTECTED]> wrote: > I have a data frame with named columns and I would like to know if it is > possible to retrieve a colum

Re: [R] retrieving object name

2006-07-10 Thread Prof Brian Ripley
On Mon, 10 Jul 2006, Laurent Deniau wrote: > I have a data frame with named columns and I would like to know if it is > possible to retrieve a column name once selected: Not really. df$col1 is a new object which does not know where it came from. If you wanted to do this before selection, then

[R] retrieving object name

2006-07-10 Thread Laurent Deniau
I have a data frame with named columns and I would like to know if it is possible to retrieve a column name once selected: print(colnames(df)) # assumes to print "col1" "col2" print.name(df$col1) # would like to print "col1" print.name(df$col2) # would like to print "col2" So what the print.n