Sys.setenv(PGHOST="192.168.1.192", PGUSER="igow", PGPORT=5434L, PGDATABASE="crsp")
library(dplyr, warn.conflicts = FALSE)
library(dbplyr, warn.conflicts = FALSE)
starwars_db <- tbl_memdb(starwars %>% select(-films, -vehicles, -starships))
is_numeric <- function(df) {
df %>%
collect(n = 1) %>%
library(rvest)
#> Loading required package: xml2
library(ggplot2)
library(dplyr, warn.conflicts = FALSE)
library(tidyr)
df <-
read_html("https://stats.espncricinfo.com/ci/content/records/227046.html") %>%
html_nodes("table") %>%
library(DBI)
library(dplyr, warn.conflicts = FALSE)
library(ggplot2)
pg <- dbConnect(RPostgres::Postgres())
rs <- dbExecute(pg, "SET work_mem TO '10GB'")
iclink <- tbl(pg, sql("SELECT * FROM ibes.iclink"))
The following is what I needed to do to get Python going on my M1 Mac mini to the extent that I could run code from Chapter 2 of Introduction to Machine Learning with Python.
wget https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-arm64.sh
bash Miniforge3-MacOSX-arm64.sh
conda install scipy matplotlib ipython scikit-learn pandas pillow
conda install -c conda-forge jupyterlab
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
DROP SCHEMA tr_ibes CASCADE; | |
CREATE SCHEMA tr_ibes; | |
ALTER SCHEMA tr_ibes OWNER TO ibes; | |
IMPORT FOREIGN SCHEMA tr_ibes | |
FROM SERVER wrds | |
INTO tr_ibes; |
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
python3 setup.py sdist bdist_wheel | |
python3 -m twine upload dist/* |
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(rvest) | |
library(dplyr, warn.conflicts = FALSE) | |
library(dataverse) | |
library(readr) | |
library(tidyr) | |
Sys.setenv("DATAVERSE_SERVER" = "dataverse.harvard.edu") | |
tmp <- tempfile(fileext = ".tab") | |
f <- get_file("1976-2016-president.tab", "doi:10.7910/DVN/42MVDX") |
Here is a SAS macro for winsorizing data that seems to be commonly used in accounting and finance research. This code comes from replication materials provided by Fang, Huang and Karpoff ("FHK") here. Below I provide an R function that produces equivalent results.
%MACRO winsorize(var, var_out, by_var, left, right, input, output);
%LET var_number = 1;
%LET var&var_number = %QSCAN(&var, &var_number, %STR( ));
%DO %WHILE (&&var&var_number NE);
%LET var_number = %EVAL(&var_number + 1);
Note that this requires dplyr
, readr
and tidyr
packages to be installed.
library(dplyr, warn.conflicts = FALSE)
ff_ind_nums <- c(5, 10, 12, 17, 30, 38, 48, 49)
get_ff_ind <- function(num = 48) {
t <- tempfile(fileext = ".zip")