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(foreign) | |
| library(dplyr) | |
| library(tidyr) | |
| library(ggplot2) | |
| library(viridis) | |
| library(ggpattern) | |
| source("../theme.R") | |
| sav23 <- suppressWarnings(read.spss("2_NZES23Release_100227.sav", | |
| to.data.frame = TRUE, add.undeclared.levels = "sort")) |
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(readr) | |
| library(dplyr) | |
| library(tidyr) | |
| library(ggplot2) | |
| library(lubridate) | |
| library(RcppRoll) | |
| source("~/theme.R") | |
| datafiles <- list.files(pattern="csv$") | |
| # remove the older provisional files that I have the directory |
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(readr) | |
| library(dplyr) | |
| library(tidyr) | |
| library(ggplot2) | |
| library(ggthemes) | |
| source("~/theme.R") | |
| WVS <- read_csv("~/Downloads/WVS_Cross-National_Wave_7_csv_v6_0.csv") | |
| shorter <- WVS |> | |
| filter(B_COUNTRY_ALPHA %in% c("DEU", "RUS","IND", "USA", "KOR", "NZL")) |> | |
| select(B_COUNTRY_ALPHA, Q7:Q17) |
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(ggplot2) | |
| library(maps) | |
| library(dplyr) | |
| # while the position data in the maps package | |
| # is very basic, that makes it simple to transform | |
| nz_map <- map_data("nz") | |
| nz_anti <- nz_map %>% | |
| mutate( |
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
| "Week_Ending","Border_Cases","Community_Cases","Deaths" | |
| 2020-02-23,0,0,0 | |
| 2020-03-01,1,0,0 | |
| 2020-03-08,4,2,0 | |
| 2020-03-15,3,0,0 | |
| 2020-03-22,56,22,0 | |
| 2020-03-29,273,180,1 | |
| 2020-04-05,160,350,0 | |
| 2020-04-12,52,232,4 | |
| 2020-04-19,16,81,7 |
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(magick) | |
| library(exiftoolr) | |
| # Hard-coded folder path | |
| folder <- "~/Desktop/photos" | |
| # Function to process images | |
| process_images <- function(folder) { | |
| # Create the "texted" subfolder if it doesn't exist | |
| texted_folder <- file.path(folder, "texted") |
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(shiny) | |
| library(magick) | |
| ui <- fluidPage( | |
| titlePanel("Image Upload and Text Overlay"), | |
| sidebarLayout( | |
| sidebarPanel( | |
| fileInput("file1", "Choose an Image File", | |
| accept = c('image/png', 'image/jpeg')), |
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(dplyr) | |
| asLines <- readLines("d12.txt") | |
| height <- length(asLines) | |
| width <- nchar(asLines[1]) | |
| chars <- strsplit(paste(asLines, collapse = ""), "")[[1]] | |
| aCropMatrix <- matrix(chars, nrow = height, byrow = TRUE) | |
| aFieldMatrix <- matrix(1:length(chars), nrow = height, byrow = TRUE) | |
| priorFieldMatrix <- matrix(rep(1, length(chars)), nrow = height, byrow = TRUE) | |
| while (!identical(priorFieldMatrix, aFieldMatrix)) { |
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(gtools) | |
| library(stringr) | |
| library(dplyr) | |
| library(tidyr) | |
| d7 <- readLines("day07.txt") | |
| #assumes you kept the resut of part1 to save work | |
| d7p1 <- as.numeric(readLines("d7p1result.txt")) | |
| p2data <- d7[d7p1 == 0] | |
| p2sums <- as.numeric(gsub(":.*","",p2data)) | |
| p2input <- gsub(".*: ","",p2data) |
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(rvest) | |
| library(dplyr) | |
| library(RcppRoll) | |
| library(tidygeocoder) | |
| library(maps) | |
| library(mapdata) | |
| library(ggplot2) | |
| library(viridis) | |
| library(patchwork) | |
| library(ggtext) |
NewerOlder