I need to convert a multi-row two-column data.frame
to a named character vector.
My data.frame
would be something like:
dd = data.
Here is a very general, easy way. Presently, it works with the development version of dplyr available via github
# devtools::install_github("tidyverse/dplyr") # dplyr_0.8.99.9003
# .rs.restartR() # Restart R session if dplyr was loaded before
library(dplyr)
iris %>%
pull(Sepal.Length, Species)
(the first argument is the values, the second argument is the names)