I have a vector like this
c(\"1\", \"a\",\"b\")
and I\'d like to create this list
list(\"a\"=1,\"b\"=1)
is
Using as.list and setNames:
as.list
setNames
x = c("1", "a","b") as.list(setNames(rep(as.numeric(x[1]), length(x) - 1), x[-1]))