Challenge 1 Roy Yoon

challenge_1
birds.csv
submission 2
Author

Roy Yoon

Published

August 15, 2022

Code
library(tidyverse)

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

Reading Data

Code
library(readr)
birds <- read_csv("_data/birds.csv")

Add any comments or documentation as needed. More challenging data sets may require additional code chunks and documentation.

A Quick Look at ‘birds’

Code
head(birds)
# A tibble: 6 × 14
  Domai…¹ Domain Area …² Area  Eleme…³ Element Item …⁴ Item  Year …⁵  Year Unit 
  <chr>   <chr>    <dbl> <chr>   <dbl> <chr>     <dbl> <chr>   <dbl> <dbl> <chr>
1 QA      Live …       2 Afgh…    5112 Stocks     1057 Chic…    1961  1961 1000…
2 QA      Live …       2 Afgh…    5112 Stocks     1057 Chic…    1962  1962 1000…
3 QA      Live …       2 Afgh…    5112 Stocks     1057 Chic…    1963  1963 1000…
4 QA      Live …       2 Afgh…    5112 Stocks     1057 Chic…    1964  1964 1000…
5 QA      Live …       2 Afgh…    5112 Stocks     1057 Chic…    1965  1965 1000…
6 QA      Live …       2 Afgh…    5112 Stocks     1057 Chic…    1966  1966 1000…
# … with 3 more variables: Value <dbl>, Flag <chr>, `Flag Description` <chr>,
#   and abbreviated variable names ¹​`Domain Code`, ²​`Area Code`,
#   ³​`Element Code`, ⁴​`Item Code`, ⁵​`Year Code`
# ℹ Use `colnames()` to see all variable names

Dimensions

Code
#understanding the dimensions of data set 'birds'
dim(birds)
[1] 30977    14

Column Names

There are 30977 rows and 14 column in the data set

Code
#column names in  data set 'birds'

colnames(birds)
 [1] "Domain Code"      "Domain"           "Area Code"        "Area"            
 [5] "Element Code"     "Element"          "Item Code"        "Item"            
 [9] "Year Code"        "Year"             "Unit"             "Value"           
[13] "Flag"             "Flag Description"

Cases when ‘birds’ data ‘Value’ is greater then 10000

Code
#looking at 'birds' data set that has 'Value' column value greater than 10000
more_than_10000 <- filter(birds, Value > 10000)

more_than_10000 
# A tibble: 8,991 × 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…    2002  2002
 2 QA           Live …       2 Afgh…    5112 Stocks     1057 Chic…    2003  2003
 3 QA           Live …       2 Afgh…    5112 Stocks     1057 Chic…    2004  2004
 4 QA           Live …       2 Afgh…    5112 Stocks     1057 Chic…    2005  2005
 5 QA           Live …       2 Afgh…    5112 Stocks     1057 Chic…    2006  2006
 6 QA           Live …       2 Afgh…    5112 Stocks     1057 Chic…    2008  2008
 7 QA           Live …       2 Afgh…    5112 Stocks     1057 Chic…    2009  2009
 8 QA           Live …       2 Afgh…    5112 Stocks     1057 Chic…    2010  2010
 9 QA           Live …       2 Afgh…    5112 Stocks     1057 Chic…    2011  2011
10 QA           Live …       2 Afgh…    5112 Stocks     1057 Chic…    2012  2012
# … with 8,981 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
arrange(more_than_10000, Value)
# A tibble: 8,991 × 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 …     211 Swit…    5112 Stocks     1057 Chic…    2013  2013
 2 QA           Live …     171 Phil…    5112 Stocks     1068 Ducks    2012  2012
 3 QA           Live …     138 Mexi…    5112 Stocks     1079 Turk…    1982  1982
 4 QA           Live …     115 Camb…    5112 Stocks     1057 Chic…    1994  1994
 5 QA           Live …     222 Tuni…    5112 Stocks     1079 Turk…    2012  2012
 6 QA           Live …      26 Brun…    5112 Stocks     1057 Chic…    2002  2002
 7 QA           Live …      49 Cuba     5112 Stocks     1057 Chic…    1965  1965
 8 QA           Live …     158 Niger    5112 Stocks     1057 Chic…    1990  1990
 9 QA           Live …     133 Mali     5112 Stocks     1057 Chic…    1961  1961
10 QA           Live …     225 Unit…    5112 Stocks     1057 Chic…    1994  1994
# … with 8,981 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

The data above shows ‘birds’ for if the Value column was greater than 10000. The data is arranged by the ‘Value’ column values.

Data for Algeria in ‘bird’

Code
#looking at 'birds' data set that has 'Value' column value greater than 10000 specifically for Algeria 
more_than_10000_ALG <- filter(more_than_10000, Area == "Algeria")

more_than_10000_ALG 
# A tibble: 54 × 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 …       4 Alge…    5112 Stocks     1057 Chic…    1965  1965
 2 QA           Live …       4 Alge…    5112 Stocks     1057 Chic…    1966  1966
 3 QA           Live …       4 Alge…    5112 Stocks     1057 Chic…    1967  1967
 4 QA           Live …       4 Alge…    5112 Stocks     1057 Chic…    1968  1968
 5 QA           Live …       4 Alge…    5112 Stocks     1057 Chic…    1969  1969
 6 QA           Live …       4 Alge…    5112 Stocks     1057 Chic…    1970  1970
 7 QA           Live …       4 Alge…    5112 Stocks     1057 Chic…    1971  1971
 8 QA           Live …       4 Alge…    5112 Stocks     1057 Chic…    1972  1972
 9 QA           Live …       4 Alge…    5112 Stocks     1057 Chic…    1973  1973
10 QA           Live …       4 Alge…    5112 Stocks     1057 Chic…    1974  1974
# … with 44 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

The data above examines the data for Algeria by looking at ‘birds’ data set that haa values greater than 10000.