This post is following above post.
Now, we now there are 4 sunjects and 2 measures.
4 subjects are BEEG, PIG, POULTRY and SHEEP.
2 measures are KG_CAP and THND_TONNE.
So, we have 8 combinations for them.
Let's make dataframes for each combination.
BEEF and KG_CAP
BEEF and THND_TONNE
PIG and KG_CAP
PIG and THND_TONNE
POULTRY and KG_CAP
POULTRY and THND_TONNE
SHEEP and KG_CAP
SHEEP and THND_TONNE
Then, I use inner_join() function to merge those 8 dataframes into one dataframe.
All right, let's use summary() function to see summary statistics.
variable mame ~~ kg means KG_CAP, it is per capita consumption and ~~ th means THSN_TONNE, it is total consumption.
Let's see bekg: BEEF KG_CAP, pikg: PIG KG_CAP, pokg: POULTRY KG_CAP and shkg: SHEEP KG_CAP.
pikg has the largest mean, so we find PIG is the most widely eaten meat.
That's it. Thank you!
Next post is.
To read the 1st post,