Skip to content
Prev 87154 / 398506 Next

Working with lists with numerical names

Christopher Swingley wrote:
Hi, Chris,

 > x <- data.frame(1:5, 6:10)
 > names(x) <- c("R", "2B")
 > x
   R 2B
1 1  6
2 2  7
3 3  8
4 4  9
5 5 10
 > x$"2B"
[1]  6  7  8  9 10
 > with(x, R + `2B`)
[1]  7  9 11 13 15

HTH,

--sundar