1

In the following list, "first" and "pio" are surrounded by double quote when the entire list is printed, apparently because they identify the first elements in their respective lists.

> list("first" = as.list(head(iris, 3)), second = list(pio = pi, poi = pi+pi))
$`first`
$`first`$`Sepal.Length`
[1] 5.1 4.9 4.7

$`first`$Sepal.Width
[1] 3.5 3.0 3.2

$`first`$Petal.Length
[1] 1.4 1.4 1.3

$`first`$Petal.Width
[1] 0.2 0.2 0.2

$`first`$Species
[1] setosa setosa setosa
Levels: setosa versicolor virginica


$second
$second$`pio`
[1] 3.141593

$second$poi
[1] 6.283185

Is the first element's name is always printed like this even though it doesn't contain a space or anything similar? If yes: why? If not what is going on? Nothing of that sort happens when printing named vectors:

> c("a s" = "hey", b = "wow")
  a s     b 
"hey" "wow" 

I'm using R version 3.5.1 (2018-07-02).

s_baldur
  • 29,441
  • 4
  • 36
  • 69

0 Answers0