I have a data table that can be created by
top_m_dt = data.table(future_fip = c(102, 104, 503),
model = c("model_1", "model_2", "model_3"),
time_period = c("F1", "F2", "F3"),
emission = c("emission_1", "emission_2", "emission_3"),
top_1_fip = c(666, 666, 666),
top_2_fip = c(666, 666, 666),
top_3_fip = c(666, 666, 666))
I would like to replace row 1 and columns top_1_fip, top_2_fip, top_3_fip
with a set of values, lets say c(10, 20, 30).
None of the followings work:
top_m_dt[1, c("top_1_fip", "top_2_fip", "top_3_fip")] <-
as.numeric(analog_dat_F1$analog_NNs_county[1:3])`
OR
top_m_dt[1, 5:7 ] <- list(analog_dat_F1$analog_NNs_county[1:3])[[1]]
OR
top_m_dt[1, (c("top_1_fip", "top_2_fip", "top_3_fip")):=
analog_dat_F1$analog_NNs_county[1:3]] `
They all replace 10 in all three locations. any suggestions?
target_fipandmodel_nandemissionvalues in quotes?