Python-like unpacking of numeric value in R [duplicate]
问题 This question already has answers here : Assign multiple new variables on LHS in a single line (14 answers) Can I assign variables in batch? [duplicate] (2 answers) Closed 6 years ago . In Python, one can do this: >>> a, b, c = (1, 2, 3) >>> a 1 >>> b 2 >>> c 3 Is there a way to do it in R, as below? > a, b, c = c(1, 2, 3) 回答1: You can do this within a list using [<- e <- list() e[c('a','b','c')] <- list(1,2,3) Or within a data.table using := library(data.table) DT <- data.table() DT[, c('a',