There are tick marks around the first name in the printed list. What is the meaning of the tick marks?
list(a = 1,b = 2,c = 3)
$`a`
[1] 1
$b
[1] 2
$c
[1] 3
There are tick marks around the first name in the printed list. What is the meaning of the tick marks?
list(a = 1,b = 2,c = 3)
$`a`
[1] 1
$b
[1] 2
$c
[1] 3
I don't have anything like that in my output:
list(a = 1,b = 2,c = 3)
#> $a
#> [1] 1
#>
#> $b
#> [1] 2
#>
#> $c
#> [1] 3
Created on 2018-07-16 by the reprex package (v0.2.0).
In general, backticks are needed when name is not syntactically valid. For example:
list(`Not a valid name` = 1,b = 2,c = 3)
#> $`Not a valid name`
#> [1] 1
#>
#> $b
#> [1] 2
#>
#> $c
#> [1] 3
Created on 2018-07-16 by the reprex package (v0.2.0).
Could it be that you are typing a
in your input from a different language?
That's a good hypothesis - I didn't think of that. No, I think the phenomenon and meaning must be explainable otherwise.
Just to confirm, I am seeing the same thing as @adpatter (but not when rendered with reprex
). I am using the latest release of R (3.5.1). But I agree with @mishabalyasin explanation of what the back ticks mean. I can not say why R is interpreting it as needing the backticks when it prints the list, but it doesn't appear to impact how you can access this variable:
temp <- list(a = 1,b = 2,c = 3)
temp
#> $a
#> [1] 1
#>
#> $b
#> [1] 2
#>
#> $c
#> [1] 3
temp$a
#> [1] 1
temp$`a`
#> [1] 1
identical(temp$a, temp$`a`)
#> [1] TRUE
Created on 2018-07-16 by the reprex package (v0.2.0).
As a side note, it is not the a = 1
portion that is causing that, as the first element was still the one put in back ticks when I changed the order of the list elements