- a data of annual precipitation of each year in a data frame
- a data table, where are is the information of year
I need to add the information of the annual precipitation to the data table according to the year key.
data_table <- data.frame("dat" = c(2010, 2010, 2010, 2011, 2011, 2012, 2012, 2012))
prec_data <- data.frame("variable" = c(2010, 2011, 2012),
"value" = c(500, 435, 451))
data_table$prec <- ??
Thank you for your attention and answers.