我需要将多行两列data.frame
转换为命名字符向量。我data.frame
会是这样的:
dd = data.frame(crit = c("a","b","c","d"),
name = c("Alpha", "Beta", "Caesar", "Doris")
)
而我真正需要的是:
whatiwant = c("a" = "Alpha",
"b" = "Beta",
"c" = "Caesar",
"d" = "Doris")