1

If I want to define a new list L=list(x=1) with x in a character variable I can run this

s = 'x'
L = list(1)
names(L) = s

Is there any simpler way to do it (in one line)? Note the name 'x' is dynamic and saved in a variable s that I can't use it directly.

Zhenduo Cao
  • 151
  • 1
  • 3

0 Answers0