Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert list variable name after $ into string

Tags:

r

I have the following variable name of list type:

tdat$`apoptotic process`

What I'd like to do is to extract the term after $ and then turn them into a string:

"apoptotic process"

How can I achieve that? I tried this but failed:

deparse(substitute(tdat$`apoptotic process`))
like image 843
neversaint Avatar asked Jun 10 '26 06:06

neversaint


1 Answers

Just use the names() function. Assuming 'apoptotic process' is the first element in list tdat:

x <- names(tdat)
x[1]
  `apoptotic process`
like image 153
Tim Biegeleisen Avatar answered Jun 18 '26 12:06

Tim Biegeleisen