Is there a way to use mapply on two vectors to construct a named list? The first vector would be of type character and contain the names used for the list while
character
You can use setNames()
setNames()
setNames(as.list(c(1, 2)), c("foo", "bar"))
(for a list) or
setNames(c(1, 2), c("foo", "bar"))
(for a vector)