www.crosshyou.info

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

OECD Discriminatory family code data analysis 2 - Making a histogram, a boxplot and an ECDF plot with R

Photo by Kentaro Toma on Unsplash 

www.crosshyou.info

This post is following of the above post.
In this post, I will make histograms, boxplots and ECDF plots with R.

Before making those plots, I made some changes to the dataframe.

I changed variable names with colnames() function.

I changed subject values to "em" and "atwm" with ifelse() function.

"em" stands for "Early Marriage".

"atwm" stands for "Attitudes Towards Working Mothers".

So, when "em" is high, "Early Marriage" ratio is high, when "atwm" is high, a country is kind to working mothers.

Let's make histograms.

First, I use ggplot() function and geom_histogram() function.

I also use hist() function and dencity() function and lines() function.

Then, I made boxplots.

Above is using ggplot() and geom_boxplot() function.
Below iss using boxplot() function

I will make ECDF plot with ggplot() and stat_ecdf() function.

I can make ECDF plot with plot() and ecdf() function.

Let's see which country is higer/lower Early Marriage, Attitudes Towards Working Mothers.

JOR has the highest Attitudes Towards Working Mothers.

Let's do it with basic functions.

ISL has the lowest Attitudes Towards Working Mothers.

Let's do it with basic functions.

Which country has the higest Early Marriage?

NER has the higest Early Marriage.

Let's do it with basic functions.

Which country has the loweat Early Marriage?

LTU has 0 value. I assume LTU has ban for Early Marriage.

Let's do it with basic functions, order(), subset() function.

That's it. Thank you!

Next post is

 

www.crosshyou.info

 



To see the first post,

 

www.crosshyou.info