crosshyou

主にクロス表(分割表)分析をしようかなと思いはじめましたが、あまりクロス表の分析はできず。R言語の練習ブログになっています。

OECD Meat Consumption Data Analysis 1 - Using R to read CSV data with read_csv() function.

f:id:cross_hyou:20210912113233j:plain


Photo by Wolfgang Hasselmann on Unsplash 

Hello! This post, I will anaysis OECD Meat Consumption data using R.

f:id:cross_hyou:20210912113432p:plain

I got a CSV file like below from OECD web site(Agricultural output - Meat consumption - OECD Data)

f:id:cross_hyou:20210912113633p:plain

Firstly, I load tidyverse package, which is very useful package for data science.

f:id:cross_hyou:20210912113944p:plain

Let's read the CSV file with read_csv() function.

f:id:cross_hyou:20210912114206p:plain

Let's see each variables.

coun is country name.

f:id:cross_hyou:20210912114348p:plain

We see all countries have 320 observations.

indi is indicator.

f:id:cross_hyou:20210912114527p:plain

indi ha sonly one value, MEATCONSUMP, so we need not keep this variable in our dataframe.

f:id:cross_hyou:20210912114715p:plain

subj means subject.

f:id:cross_hyou:20210912114859p:plain

subj has 4 kinds of value, SHEEP, POULTRY, PIG and BEEF. Each subj has 3040 observations. I convert subj to factor class.

f:id:cross_hyou:20210912115116p:plain

 

meas is measure.

f:id:cross_hyou:20210912115243p:plain

meas has two kind of value, THND_TINNE and KG_CAP. I convert meas to factor class.

f:id:cross_hyou:20210912115528p:plain

 

feq is frequency.

f:id:cross_hyou:20210912115703p:plain

freq ha only one value, A, I will remove freq from my data frame.

f:id:cross_hyou:20210912115829p:plain

year is year.

f:id:cross_hyou:20210912120001p:plain

The oldest year is 1990, the newest year is 2029! Maybe this data frame is including estimated data.

valu is meat consumption value.

f:id:cross_hyou:20210912120248p:plain

Median is 24.77 and Mean is 2291.58, so I see there is skewd data.

Let's see summary of my data frame.

f:id:cross_hyou:20210912120531p:plain

That's it!
Thank you!

Next post is

 

www.crosshyou.info