I have dataset in a particular format in "dacnet_yield_update till 2019.xlsx" file, where I need to insert the data of rows 2018-2019 and 2019-2020 for the districts those data are available in "Kharif crops yield_18-19.xlsx". I need to insert these two rows of data belonging to every district, if data is available in a later excel file, just after the particular crop group data for the particular district.
my_data <- data.frame(
crop = c(arhar, arhar, rice, moong),
season_name = rep(kharif, 4),
state_id= c(1204, 1205, 1204, 1206),
state_name= c(Asam,Bihar, Asam, Orrisa),
district_name= c(Jorhat, Patna, Naagaon, Puri),
district_id = c(15016, 16312, 15089, 17032),
year_id = c(2016, 2015, 2017, 2017),
yield= c(0.86, 1.23, 0.96, 1.05))
2nd excel sheet has same dataframe but I need to get the 2018 and 2019 yeardID data from here and insert after same district for same crop in a state.
`my_2nd_data <- data.frame(
crop = c(arhar, arhar, rice, moong),
season_name = rep(kharif, 4),
state_id= c(1204, 1205, 1204, 1206),
state_name= c(Asam,Bihar, Asam, Orrisa),
district_name= c(Jorhat, Patna, Naagaon, Puri),
district_id = c(15016, 16312, 15089, 17032),
year_id = c(2018, 2018, 2019, 2018),
yield= c(0.96, 1.16, 0.99, 1.12))`
So, the rows of 2018 and 2019 for a particular crop for from "my_2nd_data" I need to insert in first dataframe after row of same district under a state. This should look like the attached image.
I have put the data file in the given link. https://drive.google.com/drive/u/0/folders/1dNmGTI8_c9PK1QqmfIjnpbyzuiCXgxFC