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(bomrang) | |
| library(tidyverse) | |
| library(theme.usq) | |
| # Find stations ---------------------------------------------------------------- | |
| # Find nearest stations for each area | |
| # search https://www.latlong.net/ for the lat lon values of each location | |
| # clermont |
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
| # see https://www.topbug.net/blog/2013/04/14/install-and-use-gnu-command-line-tools-in-mac-os-x/ | |
| # core | |
| brew install coreutils | |
| # key commands | |
| brew install binutils | |
| brew install diffutils | |
| brew install ed | |
| brew install findutils |
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
| #' @title bibtex_2academic | |
| #' @description import publications from a bibtex file to a hugo-academic website | |
| #' @author Lorenzo Busetto, phD (2017) <lbusett@gmail.com> | |
| bibtex_2academic <- function(bibfile, | |
| outfold, | |
| abstract = FALSE, | |
| overwrite = FALSE) { | |
| require(RefManageR) |
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
| save_all <- function() { | |
| save.image("recover.rda") | |
| } | |
| options(error = save_all) |
library(tidyverse)
library(sf)Generate fake data (tribble() is a cool function, btw)
events <- tribble(
~event, ~latitude, ~longitude,
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) | |
| df <- data.frame(x = c(1:100)) | |
| df$y <- 2 + 3 * df$x + rnorm(100, sd = 40) | |
| m <- lm(y ~ x, data = df) | |
| summary(m) | |
| # see that p <2e-16 | |
| # function to create the text equation |
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(microbenchmark) | |
| mbm <- microbenchmark( | |
| one = function(), | |
| two = function(), | |
| times = 50 | |
| ) | |
| mbm | |
| library(ggplot2) | |
| autoplot(mbm) |
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
| ftp_base <- "ftp://" | |
| list_files <- curl::new_handle() | |
| curl::handle_setopt(list_files, ftp_use_epsv = TRUE, dirlistonly = TRUE) | |
| con <- curl::curl(url = ftp_base, "r", handle = list_files) | |
| files <- readLines(con) | |
| close(con) |
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
| lib <- .libPaths()[1] | |
| pkgs <- as.data.frame(installed.packages(lib), stringsAsFactors=FALSE)$Package | |
| install.packages(pkgs, type = "source") |