In R, fill in the main dataframe with data from two different data frames

Viewed 29

For my project, I am researching things related to covid from various part of the world. This particular code researches Colorado.

Currently, I have three dataframes: "main" where everything will come together, "cases" that has the number of cases from a certain source, and "death" which has the number of deaths from the same source.

Due to the nature of my work I cannot reveal all the info I have on each dataframes, but they look like the following:

Currently, cases and deaths are in the following format

Column names data format
category str
date int
metric str
value int
location_id int
location str

I want the values from both the cases and deaths dataframes to fill in the main dataframe. I want it to look something like the following

Column names data format
nid int (something I will later fill in futher down the research)
location_id int (from either the cases or deaths df)
location str (from either the cases or deaths df)
date int (from either the cases or deaths df)
deaths int(value from deaths df)
deaths_measure str (metric from deaths df)
cases int (value form cases df)
hospitalizations int (something I will later fill in futher down the research)
hospitalizations_measure str (something I will later fill in futher down the research)
ICU int (something I will later fill in futher down the research)
ICU_measure str (something I will later fill in futher down the research)

All three dataframes are here right now, with main df only consisting of column names.

0 Answers
Related