# NOT RUN {
library(data.table)
library(magrittr)
DT <- data.table(City = c("A", "A", "B", "B", "C", "D"),
value = c(1, 9, 4, 4, 5, 11))
DT %>%
mutate_other("City", var.weight = "value", mass = 10) %>%
.[]
# }
Run the code above in your browser using DataLab