Skip to content

Instantly share code, notes, and snippets.

@mxeliezer
Last active May 12, 2020 10:53
Show Gist options
  • Save mxeliezer/bfd96606e75209e6a5c35b61c3ac5081 to your computer and use it in GitHub Desktop.
Save mxeliezer/bfd96606e75209e6a5c35b61c3ac5081 to your computer and use it in GitHub Desktop.
R Script: learning to filter with 'dplyr'
# _██_
# ‹(●̮•)›
# (█)
# / |
# R Script based on Data Science Live exercises, by Rob Campanell (org.).
# Episode 1: Filter
# Avaliable from: http://datasciencelive.com/post/2020/05/01/episode1filter/
# ===== Librarys used ================================= #
library(dplyr)
library(readr)
# ===== Reading Data From URL ========================= #
seattle_art <- read_csv("https://data.seattle.gov/api/views/j7sn-tdzk/rows.csv?accessType=DOWNLOAD")
# ===== Filtering the Instalation: Classification ===== #
installation <- seattle_art %>% # reading this %>% as 'and then'.
filter(classification == 'Installation') %>%
distinct() # to eliminate the duplicates.
# ===== Filtering the Environments: Classification ===== #
environments <- seattle_art %>%
filter(classification == 'Environments') %>%
distinct()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment