- Have a look around the files here. Where are the R scripts? What are the directories
data
andfigs
for? Do the names and structure help you find things? - Open each R script, finish it, and run it. Remember to restart R as you go, so you are certain each file is complete, i.e. data flows through explicit write/read, not the global workspace.
R/01_write-installed-packages.R
R/02_wrangle-packages.R
R/03_barchart-packages-built.R
- It's OK if you don't finish! We can keep working on this later.
- If you finish quickly, write an R script to run the whole analysis and, perhaps, another script that does a
make clean
style reset.
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(dtplyr) | |
library(readr) | |
suppressPackageStartupMessages(library(dplyr)) | |
suppressPackageStartupMessages(library(data.table)) | |
# It is generally better not to benchmark the print methods to avoid misleading | |
# results, also vroom is faster on this particular dataset than | |
# either readr or data.table | |
bench::mark( |
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
callr/README.md: #> $message | |
installgithub.app/install-github.R: msg$message | |
installgithub.app/install-github.R: if (methods::is(response, "error") || !is.null(response$message)) { | |
remotes/install-github.R: error_details <- json$parse(rawToChar(res$content))$message | |
remotes/install-github.R: response$message) | |
remotes/install-github.R: if (methods::is(response, "error") || !is.null(response$message)) { | |
remotes/install-github.R: response$message) | |
gh/R/gh_response.R: paste0("Message: ", res$message) | |
callr/R/utils.R: exp <- tryCatch(parse(text = "1+"), error = function(e) e$message) | |
callr/R/result.R: err[[2]]$message <- err[[2]]$message %||% "interrupt" |
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
# RStudio overrides `history()`, `loadhistory()` and `savehistory()`, | |
# so they work somewhat differently than on the console version of R. | |
# This saves the current history to a temporary file then reads the last | |
# line of it (or more depending on the `n` argument) | |
# | |
# It does not handle multi-line commands, which would be more tricky to handle... | |
previous_commands <- function(n = 1) { | |
tf <- tempfile() | |
on.exit(unlink(tf)) | |
savehistory(tf) |
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
# Measure usage of GitHub vs GitLab in R packages. This likely undercounts both GitHub and GitLab, | |
# becuase not every package puts a link to the development repository in their URL or BugReports fields. | |
# remotes::install_github("r-hub/crandb") | |
last_1000 <- crandb::events(archivals = FALSE, limit = 1000) | |
has_url <- function(x, url) { | |
any(grepl(url, c(tolower(x$package$URL), tolower(x$package$BugReports)), fixed = TRUE)) | |
} |
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
From c2808f4d0f20682d9185d0e68bd33fe98d2dc7c2 Mon Sep 17 00:00:00 2001 | |
From: Jim Hester <[email protected]> | |
Date: Mon, 22 Apr 2019 07:43:48 -0400 | |
Subject: [PATCH] Avoid using eval-parse | |
--- | |
R/factory.R | 4 +--- | |
1 file changed, 1 insertion(+), 3 deletions(-) | |
diff --git a/R/factory.R b/R/factory.R |
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(gh) | |
library(tidyverse) | |
library(processx) | |
me <- "jimhester" | |
title <- "Remove default assets" | |
branch_name <- "remove-default_assets" | |
search <- gh("GET /search/code", q = "default_assets user:tidyverse") |
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
cp /c/Users/Administrator/RStudio/rarrow/configure.win . | |
cp -r /c/Users/Administrator/RStudio/rarrow/tools . | |
cp /c/Users/Administrator/RStudio/rarrow/src/Makevars.win src/ | |
# Change version in Makevars.win to 0.11.0 | |
## this assumes arrow is installed via `make install` | |
mkdir -p windows/arrow-0.11.0/lib/x64 | |
cp -r /c/Program\ Files\ \(x86\)/arrow/include windows/arrow-0.11.0/ | |
cp /c/Program\ Files\ \(x86\)/arrow/lib/libarrow.a windows/arrow-0.11.0/lib/x64/ |
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
# Open your R profile | |
# Hint: use the usethis package | |
usethis::edit_r_profile() | |
# Change the default CRAN mirror | |
# Hint: The repos option takes a named list of repositories | |
# A good default repo is https://cran.rstudio.com | |
options(repos = c(CRAN = "https://cran.rstudio.com")) | |
# Change the default startup message to something using the cowsay package, |
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
#' Which libraries does R search for packages? | |
# try .libPaths(), .Library | |
#' Installed packages | |
## use installed.packages() to get all installed packages | |
## if you like working with data frame or tibble, make it so right away! | |
## remember to use View() or similar to inspect |