www.crosshyou.info

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

OECD Threatened species data analysis 1 - read csv file into R

Hello. In this blog, I will analyize OECD Threatend species data.
First, I goet data from OECD web site.

f:id:cross_hyou:20210516162641p:plain

Biodiversity - Threatened species - OECD Data

The csv file looks below

f:id:cross_hyou:20210516162741p:plain

Let's read this file into R.

First of all, load tidyverse pachage.

f:id:cross_hyou:20210516163102p:plain

Then, use read_csv() function to read a csv file.

f:id:cross_hyou:20210516163318p:plain

let's check if we load the file sucsessfully with str() function.

f:id:cross_hyou:20210516163716p:plain

It seems we successfully load the csv file data.

The, check how may values are threre in each variables. I use table() function.

f:id:cross_hyou:20210516164314p:plain

So, there are 36 locations and 3 subjects. Others are only one value.
INDICATOR is THREATENED, MEASURE is PC_SPECIES, FREQUENCY is A and TIME is 2015.
So, this data is as of 2015 data set.

Let's remove INDICATOR, MEASURE, FREQUENCY and TIME.

f:id:cross_hyou:20210516165209p:plain

I made SUBJECT to factor class.

f:id:cross_hyou:20210516164946p:plain

Then, use summary to see data frame summary.

f:id:cross_hyou:20210516165304p:plain

Value is number of threatened species expressed as percentage of total known species. So the highest dangerous location has 53.556% and lthe owest locations has 1.754%.
That's it.
For the next blog

 

www.crosshyou.info