Select (dplyr) operator with '-'
How do I use a SELECT (dplyr library) statement with a name containing '-'? For example:
AdultUCI %>% select(capital-gain)
called:
+3
Kulis
source
to share
2 answers
try it
data.frame(`a-b` = 1, c = 2, check.names = FALSE) %>%
select(`a-b`)
# a-b
# 1 1
+8
lukeA
source
to share
We can use matches
insideselect
data.frame(`a-b` = 1, c = 2, check.names = FALSE) %>%
select(matches('-'))
# a-b
# 1 1
+2
akrun
source
to share