This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#This R script creates wordcloud of CRAN package titles since 2020. | |
library(rvest) | |
library(ggplot2) | |
library(dplyr) | |
library(tokenizers) | |
library(SnowballC) | |
library(stopwords) | |
library(ggwordcloud) | |
URL<- "https://cran.r-project.org/web/packages/available_packages_by_date.html" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#This R script create a visualization showing CRAN packages by year added. | |
library(rvest) | |
library(ggplot2) | |
library(cowplot) | |
URL<- "https://cran.r-project.org/web/packages/available_packages_by_date.html" | |
#scrape table data from CRAN website | |
getthis<- xml2::read_html(URL) | |
cran_df<-rvest::html_table(getthis) %>% data.frame(.) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#"The Pulse of COVID" | |
#This R script creates an audio 'visualization' of covid data from the CDC. | |
#Notes on what you'll hear: (1) New cases aggregated to week are scaled as the volume and new deaths as the pitch. | |
#(2) The addition of new data over time will affect the scaled output sound of code re-reun in the future. | |
library(RSocrata) #For downloading CDC data. | |
library(tuneR) #Making a .wav file | |
library(dplyr) | |
library(lubridate) #Date math --aggregating daily data into weekly data. | |
#Download data from the CDC. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#This R script demonstrates use of the library ggpattern to add image textures to visualizations + magick to edit image files | |
library(ggpattern) #remotes::install_github("coolbutuseless/ggpattern") | |
library(ggplot2) | |
library(magick) | |
library(tibble) | |
library(dplyr) | |
#create data to visualize | |
cakes<-tibble( cake_name=c("Chocolate Cake","Cream Cake ","Pound Cake", | |
"White or Yellow Cake","Devil’s Food Cake", | |
"Sponge Cake","Angel Food Cake","Water"), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Eample visualization to demonstrate use of ggplot + ggtextures + magick images`` | |
library(magick) | |
library(ggplot2) | |
library(ggtextures) #Not on CRAN. Use: devtools::install_github("clauswilke/ggtextures") | |
library(dplyr) | |
#Source data 'https://www.icco.org/wp-content/uploads/Grindings_QBCS-XLVII-No.-1.pdf' | |
df<-tibble(country= c("Germany", "Cote d'ivoire", "Netherlands", "USA", "Indonesia"), | |
grindings= c(430, 610, 600, 385, 485), | |
flag_img= c("de","ci","nl","us","id"), | |
img = list( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#This R script downloads King County WA parcel open data in R as an sf object, and creates point-based centroids for each_parcel. | |
#This script is intented to help you get up and running. | |
#Tempfile used for downloading. | |
temp <- tempfile() | |
temp2 <- tempfile() | |
#Download the open data ArcGIS zip folder containing the parcel data as a .shp file. | |
# As an alternative, you can download KML or csv version from here: https://gis-kingcounty.opendata.arcgis.com/datasets/parcels-for-king-county-with-address-with-property-information-parcel-address-area | |
download.file("https://opendata.arcgis.com/datasets/c7a17b7ad3ec44b7ae64796dca691d72_1722.zip",temp) | |
#Unzip the contents of 'temp' object and save unzipped content in 'temp2' |