How do I use a SELECT (dplyr library) statement with a name containing '-'? For example:
AdultUCI %>% select(capital-gain)
called:
try it
data.frame(`a-b` = 1, c = 2, check.names = FALSE) %>% select(`a-b`) # a-b # 1 1
We can use matches insideselect
matches
select
data.frame(`a-b` = 1, c = 2, check.names = FALSE) %>% select(matches('-')) # a-b # 1 1