Читать книгу The Big R-Book - Philippe J. S. De Brouwer - Страница 244

Digression – Special characters in column names

Оглавление

Note the back-ticks in `sin(x)` when the tibble reports on itself. That is of course because in R variables are not allowed to use brackets in their names. The tibble does allow in the names of columns non-R-compliant variable names. To address this column by name, we need to refer to the column by its number or use back-ticks.

tb$`sin(x)`[1] ## [1] 0

This convention is not specific to tibbles, it is used throughout R (e.g. the same back-ticks are needed in ggplot2, tidyr, dyplr, etc.).

The Big R-Book

Подняться наверх