I have two data.tables similar to tables below. I want to find the values from the first table if the values of first column and column names between two tables match and assign it to the second table.
I tried to generate similar examples using mtcars dataset
mtcars_first <- add_column(mtcars, car = rownames(mtcars), .before = 1)
mtcars_second <- rbind(
c("Hornet 4 Drive",NA,NA,NA),
c("Valiant",NA,NA,NA),
c("Duster 360" ,NA,NA,NA)) %>% as.data.table()
colnames(mtcars_second) <- c("car","disp","drat","qsec")