0

Consider the two lists

> list('a' = 1, 'b' = 2)
$`a`
[1] 1
$b
[1] 2

> list( z = 0, a = 1, b = 2) # added space just in case
$`z`
[1] 0
$a
[1] 1
$b
[1] 2

Why is the name of the first (and only the first) element quoted?

I found a similar issue on this SO question but it didn't explain (or at least I failed to understand) why the above occurs.


PS

When accessing list elements by names using the $ notation the problem does not appear, i.e. l1$a works just as well as l1$'a' (with " ` " instead of " ' ").

niko
  • 5,253
  • 1
  • 12
  • 32

0 Answers0