I have a data frame of two columns: key and value and I would like to create a dictionary using the respective row of each column for each element of the dictionary / hash t
The easiest way is to change names after creating variables. So you can define a function like this:
cc <- function(name, value) {
ret <- c(value)
names(ret) <- name
ret
}
cc(c(letters[1:2], "a name"), c(LETTERS[1:2], "a value"))
# output like this
# a b a name
# "A" "B" "a value"