challenge_1
Author

Young Soo Choi

Published

August 15, 2022

Code
library(tidyverse)

knitr::opts_chunk$set(echo = TRUE, warning=FALSE, message=FALSE)

Challenge Overview

Today’s challenge is to

  1. read in a dataset, and

  2. describe the dataset using both words and any supporting information (e.g., tables, etc)

Read in the Data

I choose data about birds.

Code
library(readr)
birds <- read_csv("_data/birds.csv")
birds
# A tibble: 30,977 × 14
   Domain Cod…¹ Domain Area …² Area  Eleme…³ Element Item …⁴ Item  Year …⁵  Year
   <chr>        <chr>    <dbl> <chr>   <dbl> <chr>     <dbl> <chr>   <dbl> <dbl>
 1 QA           Live …       2 Afgh…    5112 Stocks     1057 Chic…    1961  1961
 2 QA           Live …       2 Afgh…    5112 Stocks     1057 Chic…    1962  1962
 3 QA           Live …       2 Afgh…    5112 Stocks     1057 Chic…    1963  1963
 4 QA           Live …       2 Afgh…    5112 Stocks     1057 Chic…    1964  1964
 5 QA           Live …       2 Afgh…    5112 Stocks     1057 Chic…    1965  1965
 6 QA           Live …       2 Afgh…    5112 Stocks     1057 Chic…    1966  1966
 7 QA           Live …       2 Afgh…    5112 Stocks     1057 Chic…    1967  1967
 8 QA           Live …       2 Afgh…    5112 Stocks     1057 Chic…    1968  1968
 9 QA           Live …       2 Afgh…    5112 Stocks     1057 Chic…    1969  1969
10 QA           Live …       2 Afgh…    5112 Stocks     1057 Chic…    1970  1970
# … with 30,967 more rows, 4 more variables: Unit <chr>, Value <dbl>,
#   Flag <chr>, `Flag Description` <chr>, and abbreviated variable names
#   ¹​`Domain Code`, ²​`Area Code`, ³​`Element Code`, ⁴​`Item Code`, ⁵​`Year Code`
# ℹ Use `print(n = ...)` to see more rows, and `colnames()` to see all variable names

This dataset contains over 30000 birds’ characters include area, years, etc.

Describe the data

This data set I read contains data from 1961. I wonder how many birds of that year code is after year 2000 in this data set.

Code
a2000<-filter(birds, Year>=2000)
a2000
# A tibble: 10,945 × 14
   Domain Cod…¹ Domain Area …² Area  Eleme…³ Element Item …⁴ Item  Year …⁵  Year
   <chr>        <chr>    <dbl> <chr>   <dbl> <chr>     <dbl> <chr>   <dbl> <dbl>
 1 QA           Live …       2 Afgh…    5112 Stocks     1057 Chic…    2000  2000
 2 QA           Live …       2 Afgh…    5112 Stocks     1057 Chic…    2001  2001
 3 QA           Live …       2 Afgh…    5112 Stocks     1057 Chic…    2002  2002
 4 QA           Live …       2 Afgh…    5112 Stocks     1057 Chic…    2003  2003
 5 QA           Live …       2 Afgh…    5112 Stocks     1057 Chic…    2004  2004
 6 QA           Live …       2 Afgh…    5112 Stocks     1057 Chic…    2005  2005
 7 QA           Live …       2 Afgh…    5112 Stocks     1057 Chic…    2006  2006
 8 QA           Live …       2 Afgh…    5112 Stocks     1057 Chic…    2007  2007
 9 QA           Live …       2 Afgh…    5112 Stocks     1057 Chic…    2008  2008
10 QA           Live …       2 Afgh…    5112 Stocks     1057 Chic…    2009  2009
# … with 10,935 more rows, 4 more variables: Unit <chr>, Value <dbl>,
#   Flag <chr>, `Flag Description` <chr>, and abbreviated variable names
#   ¹​`Domain Code`, ²​`Area Code`, ³​`Element Code`, ⁴​`Item Code`, ⁵​`Year Code`
# ℹ Use `print(n = ...)` to see more rows, and `colnames()` to see all variable names
Code
count(a2000)
# A tibble: 1 × 1
      n
  <int>
1 10945

And the number of birds with year 2000 after is 10945.