Skip to content
Prev 322719 / 398500 Next

R Function to extract columnNames

On Apr 30, 2013, at 6:00 AM, arun wrote:

            
To ST;

You should now realize that this function has already been built into R and its name is "[[".

The "$" function is just variation on "[[" that does not evaluate its argument. You effort to parse back to  paste("df",x,sep="$") failed, but might have succeeded if you took this route:

eval(parse(text= paste("df",x,sep="$") ) )

I'm not saying you should have done that since obviously "[[" is the proper, approved, economical way to do it. I'm just trying to get you to understand the language better. You should spend further time with:

help("Extract")    # to cement this lesson and extend your understanding.