library(readxl)
library(httr2)
library(tidyverse)
# Define file URL and destination path
url <- "https://www.jobsandskills.gov.au/sites/default/files/2024-12/occupation_profiles_data_-_november_2024.xlsx"
destfile <- "occupation_profiles_data.xlsx"
# Create request with headers
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
libname home '.'; | |
PROC SQL; | |
CREATE TABLE crsp_dates AS | |
SELECT date, intnx('MONTH', date, 0, 'BEGINNING') AS month format=yymmdd10. | |
FROM crsp.msi | |
ORDER BY date; | |
QUIT; | |
DATA crsp_dates; |
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
libname home '.'; | |
PROC SQL; | |
CREATE TABLE crsp_dates AS | |
SELECT date, intnx('MONTH', date, 0, 'BEGINNING') AS month format=yymmdd10. | |
FROM crsp.msi | |
ORDER BY date; | |
QUIT; | |
DATA crsp_dates; |
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
library(farr) | |
library(tidyverse) | |
original <- read_csv("~/Downloads/WalkerDataCodeMar2021/original.csv") | |
original |> | |
group_by(fyear) |> | |
summarize(auc = auc(prob, aaer), .groups = "drop") |> | |
mutate(avg_auc = mean(auc)) |
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
install.packages(c("formatR", "markdown", "tinytex", "downlit", "xml2")) |
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
library(dplyr, warn.conflicts = FALSE) | |
library(DBI) | |
db <- dbConnect(duckdb::duckdb()) | |
dbExecute(db, "ATTACH '' AS pg (TYPE POSTGRES);") | |
dbExecute(db, "COPY pg.crsp.dsf FROM '/Users/iangow/Library/CloudStorage/Dropbox/pq_data/crsp/dsf.parquet'") | |
create_view <- function(conn, table, schema = "", |
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
library(httr2) # request(), req_*(), resp_body_html() | |
library(rvest) # html_elements(), html_table() | |
library(tidyverse) | |
extract_team_ids <- function(link_text) { | |
matches <- str_match(link_text, '<a href="teams/(.*)_idx.html">(.*)</a>') | |
team_id <- matches[, 2] | |
team_name <- matches[, 3] | |
tibble(team_id, team_name) | |
} |
library(tidyverse)
library(DBI)
library(googlesheets4)
options(gargle_oauth_email = TRUE)
gs_2024 <- as_sheets_id("1Qymhw_LGN1Z00ip_qswa29yPeZzWvTymD-u-lMY8b-A")
nnhs_2024 <- read_sheet(gs_2024, na = c("", "N/A"))
library(tidyverse)
regions <- c("USA", "Australia", "China")
years <- 2017:2023L
markets <- letters[1:4]
nn <- 1000
sample_n <- function(var, n = nn) {
var <- rlang::ensym(var)
NewerOlder