library(readr)
library(dplyr, warn.conflicts = FALSE)
site_url <- "https://raw.githubusercontent.com/JarFraud/FraudDetection/master/"
final_df_filename <- "data_FraudDetection_JAR2020.csv"
final_df <- read_csv(paste0(site_url, final_df_filename),
col_types = "d")
aaer_df_filename <- "AAER_firm_year.csv"
library(quantmod)
#> Loading required package: xts
#> Loading required package: zoo
#>
#> Attaching package: 'zoo'
#> The following objects are masked from 'package:base':
#>
#> as.Date, as.Date.numeric
#> Loading required package: TTR
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(tidyverse) | |
scores <- | |
tribble( | |
~value, ~count, | |
1, 0, | |
2, 2, | |
3, 7, | |
4, 5, | |
5, 6, |
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(tidyverse) | |
library(lubridate) | |
read_weather <- function(file, var) { | |
read_csv(file, | |
col_names = c("code", "station", "year", "month", "day", | |
var, "days_accum", "quality"), | |
col_types = "ciiiiddc", | |
skip = 1) %>% | |
filter(!is.na(year), !is.na(month), !is.na(day)) %>% |
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(dbplyr) | |
library(DBI) | |
library(ggplot2) | |
library(stargazer) | |
library(sandwich) | |
library(robustbase) | |
library(lfe) | |
library(purrr) | |
library(tidyr) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
--- | |
title: "Performance over time" | |
format: pdf | |
editor: visual | |
--- | |
```{r, message=FALSE, include=FALSE} | |
library(DBI) | |
library(dplyr, warn.conflicts = FALSE) | |
library(dbplyr) |
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
table_sql <- "SELECT n.nspname AS \"Name\", | |
pg_catalog.pg_get_userbyid(n.nspowner) AS \"Owner\" | |
FROM pg_catalog.pg_namespace n | |
WHERE n.nspname !~ '^pg_' AND n.nspname <> 'information_schema' | |
ORDER BY 1" | |
library(dplyr, warn.conflicts = FALSE) | |
library(DBI) | |
pg <- dbConnect(RPostgres::Postgres()) |
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) | |
df <- tibble(test = c(rep(TRUE, 24), rep(FALSE, 11), | |
rep(TRUE, 112), rep(FALSE, 104), | |
rep(TRUE, 113), rep(FALSE, 139), | |
rep(TRUE, 10), rep(FALSE, 21)), | |
mask = c(rep("None", 24 + 11), | |
rep("Cloth", 112 + 104), | |
rep("Surgical", 113 + 139), | |
rep("N95", 10 + 21))) %>% |
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(readxl) | |
library(dplyr, warn.conflicts = FALSE) | |
get_data <- function(date) { | |
date <- as.Date(date) | |
date_str <- gsub(" ", "", tolower(format(date, "%B-%e-%Y"))) | |
url <- paste0("https://www.mass.gov/doc/covid-19-raw-data-", date_str, | |
"/download") | |
t <- tempfile() | |