Reputation: 1134
I have a dataframe
df
Some columns in the dataframe
column1|column2|column3|`column 4`|column5|`column 6`
How could I identify column names containing spaces (column 4
and column 6
) and export them as vectors?
c(`column 4`,`column 6`)
Upvotes: 1
Views: 307
Reputation: 1196
I believe you want to use select
from dplyr
:
df %>%
select(contains("X"))
vec4 <- df$X.column.4.
vec6 <- df$X.column.6.
vec46 <- c(vec4, vec6)
Upvotes: 1