How do you extract a single column from a tibble?
If the tibble is named Orig and you want the column named id:
This will give you a vector of the values
This will also give you a vector of the values
The following two commands will give you a one column tibble
library(dplyr) select(Orig, id)
R gives you lots of ways to do this!
Yet another way is using
pull from the
dplyr package - this gives you the column as a vector:
df %>% dplyr::pull(col)
or if you want to be a real special snowflake you can use %$% from
library(magrittr) df %$% col
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
If you have a query related to it or one of the replies, start a new topic and refer back with a link.