www.crosshyou.info

政府統計の総合窓口のデータや、OECDやUCIやのデータを使って、Rの練習をしています。ときどき、読書記録も載せています。

OECD Meat Consumption Data Analysis 2 - PIG is the most popular meat.

f:id:cross_hyou:20210913202112j:plain

Photo by boris misevic on Unsplash 

www.crosshyou.info

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

f:id:cross_hyou:20210913202537p:plain

BEEF and THND_TONNE

f:id:cross_hyou:20210913202626p:plain

PIG and KG_CAP

f:id:cross_hyou:20210913202707p:plain

PIG and THND_TONNE

f:id:cross_hyou:20210913202753p:plain

POULTRY and KG_CAP

f:id:cross_hyou:20210913202833p:plain

POULTRY and THND_TONNE

f:id:cross_hyou:20210913202918p:plain

SHEEP and KG_CAP

f:id:cross_hyou:20210913203014p:plain

SHEEP and THND_TONNE

f:id:cross_hyou:20210913203106p:plain

Then, I use inner_join() function to merge those 8 dataframes into one dataframe.

f:id:cross_hyou:20210913203223p:plain

All right, let's use summary() function to see summary statistics.

f:id:cross_hyou:20210913203456p:plain

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.

 

www.crosshyou.info

 



To read the 1st post,

 

www.crosshyou.info