[Rd] The behaviour of setting names differs between lists and atomic vectors

Richard Cotton richierocks at gmail.com
Thu Aug 21 15:26:20 CEST 2014

If you set the names in a list, some cat-style processing seems to
happen.  For example, backslashes are modified.  This behaviour
doesn't happen with atomic vectors.  Compare, for example:

setNames(1, "a\\b")
## a\\b
##   1
setNames(list(1), "a\\b")
## $`a\b`
## [1] 1

Notice that the name of the element in the list has been changed to
'a', 'backspace'.

Is this behaviour intended, or a bug?


More information about the R-devel mailing list