www.crosshyou.info

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

OECD Adult education level data analysis 1 - Importing CSV file into R using read_CSV() and making a data frame to analyze.

UnsplashWeiye Tanが撮影した写真 


In this post, I will analyze OECD Adult education level data.

First, I downloaded CSV file from OECD web site.
{Education attainment - Adult education level - OECD Data}

It is like above screen-shot.

I alos download GDP data from OECD web site.

{GDP and spending - Gross domestic product (GDP) - OECD Data}

I use R to analyze those data.

First, I load tidyverse package.

I use read_csv to CSV files.

Let's use glimpse() function to check whether I import those CSV files correctly.

The both data frames(exactly saying, it is tibble) have 7 columns with same variable names.

To check each variables, I use skim() fruntion from skimr package.

All 7 variables does not have NA. INDICATOR, MEASURE and FREQUENCY have only 1 value, so I can delete them.

Let' see raw_gdp.

Again, all 7 variables does not have NA and INDICATOR, SUBJECT and FREQUENCY have only 1 value. I delete them.

Then, I convert those data frames to wide format using pivot_wider() function.

Then, I merge these two data frmeas into one data frame using inner_join() function.

Finally, I get a data frame to analyze.
That's it. Thank you!