Rで何かをしたり、読書をするブログ

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

OECD Household disposable income data analysis 4 - make a data frame by country and by year using R.

f:id:cross_hyou:20210815081140j:plain

 Photo by Olga Tsai on Unsplash  

www.crosshyou.info

 This post is following of above post.

In this post, let's make average value data frame by country and by year.

First, I make a data frame for average value by country using group_by() function and summarize() function using R.

f:id:cross_hyou:20210815082802p:plain

The, let's make a sacatter plot.

f:id:cross_hyou:20210815082824p:plain

f:id:cross_hyou:20210815082839p:plain

I load ggthemes and ggrepel packages to make a professional looking graph.

f:id:cross_hyou:20210815083131p:plain

Let's make a economist style graph.

f:id:cross_hyou:20210815083653p:plain

f:id:cross_hyou:20210815083704p:plain

We see GROSSADJ & USD_CAL and NET_AGRWTH are negative correlation.

Next, let's make a data frame by year.

f:id:cross_hyou:20210815084229p:plain

Let's make a scatter plot.

f:id:cross_hyou:20210815084833p:plain

f:id:cross_hyou:20210815084848p:plain

We see GROSSADJ & USD_CAP and NET & AGRWTH are negative correlation.

Next, let's see year vs. gr_us

f:id:cross_hyou:20210815085423p:plain

f:id:cross_hyou:20210815085434p:plain

We see GROSSADJ & USD_CAP has increasing trend.

How about NET & AGRWTH?

f:id:cross_hyou:20210815090637p:plain

f:id:cross_hyou:20210815090649p:plain

We see NET & AGRWTH has downward trend and it is more volatile than GROSSADJ & USD_CAP.

That's it. Thank you!

 Next post is

 

www.crosshyou.info

 

to see the 1st post,

 

www.crosshyou.info