www.crosshyou.info

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

OECD Trust in government data analysis 1 - Using R read_csv() function to load CSV file data.

f:id:cross_hyou:20211113204302j:plain

Photo by Taun Stewart on Unsplash 

f:id:cross_hyou:20211113204038p:plain

I this series of posts, I will analysis OECD data, "Trust in governmet".
I got below CSV file from General government - Trust in government - OECD Data

f:id:cross_hyou:20211113204714p:plain

I use R to analyze this data.

Firstly, I load tidyverse package.

f:id:cross_hyou:20211113205158p:plain

Then, I use read_csv() function to load CSV data into R.

f:id:cross_hyou:20211114081454p:plain

I copy df_raw to df so that I don't nead to use read_csv() again if I did mistake with the dataframe.

Let's check each vatiables.

LOCATION

f:id:cross_hyou:20211114082114p:plain

LOCATION means ISO country code. We see max observation number is 15.
So, I will filter countries which has 15 observations.

f:id:cross_hyou:20211114082517p:plain

Next variable is INDICATOR we check.

f:id:cross_hyou:20211114082730p:plain

INDICATOR is only one value, TRUSTGOV, so I will delete it from the df.

f:id:cross_hyou:20211114082917p:plain

Next, let's chack SUBJECT

f:id:cross_hyou:20211114083049p:plain

I will delete SUBJECT too.

f:id:cross_hyou:20211114083152p:plain

Next, let's see MEASURE.

f:id:cross_hyou:20211114083341p:plain

I can delete MEASURE too because there is only one value; PC.

f:id:cross_hyou:20211114083602p:plain

Then, let's see FREQUENCY

f:id:cross_hyou:20211114083823p:plain

I will delete FREQUENCY

f:id:cross_hyou:20211114084001p:plain

Let's see TIME

f:id:cross_hyou:20211114084221p:plain

TIME means year. We have data from 2006 to 2020 for 21 LOCATIONS.

The last variable is value, it is percentage of trust in government.

f:id:cross_hyou:20211114084543p:plain

The minimum trust percentage is only 6.877%!  The average is 40.239% and the maximum is 71.580%.

That's it.

Thank you!

Next post is

 

www.crosshyou.info