This file contains hidden or 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
############# | |
## Dataset on ICE enforcement from Sep. 1, 2023 to Jun. 26, 2025 | |
## Source: https://deportationdata.org/data/ice.html | |
############# | |
############# | |
## Read in data | |
############# | |
## Arrest data |
This file contains hidden or 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
############# | |
## Dataset on ICE enforcement from Sep. 1, 2023 to Jun. 26, 2025 | |
## Data source: https://deportationdata.org/data/ice.html | |
############# | |
############# | |
## Read in data | |
############# | |
## Arrest data |
This file contains hidden or 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
# download data from https://www.ice.gov/detain/detention-management | |
# see blog for more details https://jef.works/blog/2025/07/10/analyzing-ice-detention-data/ | |
# read in data | |
library(readxl) | |
fy21 = readxl::read_xlsx('FY21-detentionstats.xlsx', sheet=4, skip=6) | |
fy22 = readxl::read_xlsx('FY22-detentionstats.xlsx', sheet=7, skip=6) | |
fy23 = readxl::read_xlsx('FY23_detentionStats.xlsx', sheet=8, skip=5) | |
fy24 = readxl::read_xlsx('FY24_detentionStats.xlsx', sheet=8, skip=6) | |
fy25 = readxl::read_xlsx('FY25_detentionStats06202025.xlsx', sheet=7, skip=6) |
This file contains hidden or 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
# playing stairway to heaven using R | |
# hand transcribed notes | |
notes <- list( | |
'A3', 'C4', 'E4', 'A4', | |
c('B4', 'G#3'), 'E4', 'C4', 'B4', | |
c('C4', 'G3'), 'E4', 'C4', 'C5', | |
c('F#4', 'F#3'), 'D4', 'A3', 'F#4', | |
c('E4', 'F3'), 'C4', 'A3', 'C4', | |
NA, 'E4', 'C4', 'A3', |
This file contains hidden or 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
## following https://alistaire.rbind.io/blog/fireworks/ | |
## but manually convert to polar coordinates to be able to add | |
## background image, which cannot be used with coord_polar() | |
library(ggplot2) | |
library(gganimate) | |
theme_set(theme_void()) | |
## create set of points in polar coordinates | |
set.seed(0) |
This file contains hidden or 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
##################### Visualizing parameters for clustering PBMCs using gganimate | |
library(ggplot2) | |
library(gganimate) | |
## PBMC dataset | |
library(MUDAN) | |
data("pbmcA") | |
## Downsample to run faster | |
cd <- MUDAN::cleanCounts(pbmcA)[, 1:2000] |
This file contains hidden or 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
#' Hatching photo filter | |
#' | |
#' @param img matrix representation of black and white image | |
#' @param N number of points to be used for hatching | |
#' @param size average size of points | |
#' @param var variability in size of points | |
#' @param step step size between shades of grey | |
#' @param pch point shape (note pch=4 is a hatch but other shapes can be used as well) | |
#' | |
#' @examples |
This file contains hidden or 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
## Use flickr API to get 20 public images for flowers | |
data1 = paste0(readLines('https://api.flickr.com/services/feeds/photos_public.gne?tags=lilacs'), collapse="") | |
data2 = paste0(readLines('https://api.flickr.com/services/feeds/photos_public.gne?tags=cherryblossoms'), collapse="") | |
data3 = paste0(readLines('https://api.flickr.com/services/feeds/photos_public.gne?tags=marigolds'), collapse="") | |
data4 = paste0(readLines('https://api.flickr.com/services/feeds/photos_public.gne?tags=daffodils'), collapse="") | |
dataLines = c( | |
strsplit(data1, "<entry>")[[1]][-1], | |
strsplit(data2, "<entry>")[[1]][-1], | |
strsplit(data3, "<entry>")[[1]][-1], | |
strsplit(data4, "<entry>")[[1]][-1] |
This file contains hidden or 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
library(jpeg) | |
library(rvest) | |
## Image urls | |
urls <- c( | |
"http://www.instagram.com/p/BWIKgiuADnP/media/?size=m", | |
"http://www.instagram.com/p/BXY2LnqgB-g/media/?size=m", | |
"http://www.instagram.com/p/BZhL7zlg0cE/media/?size=m", | |
"http://www.instagram.com/p/BaHDmk5AOYe/media/?size=m", | |
"http://www.instagram.com/p/BcDKJywAMh4/media/?size=m", |
This file contains hidden or 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
library(Rcpp) | |
#' Floyd-Steinberg dithering | |
#' | |
#' @description Rcpp C++ function for Floyd-Steinberg dithering | |
#' More info: https://en.wikipedia.org/wiki/Floyd%E2%80%93Steinberg_dithering | |
#' Note, this is a C++ translation of the FloydConvolution function by Todos Logos | |
#' from https://www.r-bloggers.com/r-is-a-cool-image-editor-2-dithering-algorithms/ | |
#' | |
#' @param x Greyscaled 2D image matrix |
NewerOlder