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(httr) | |
| any_redirect = function(x) { | |
| hdrs = x$all_headers | |
| statuses = sapply(hdrs, `[[`, "status") | |
| res = lapply(statuses, httr::http_status) | |
| res = sapply(res, `[[`, "category") | |
| "redirection" %in% tolower(res) | |
| } | |
| res300 = GET("http://httpbin.org/status/300") |
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) | |
| library(dplyr) | |
| geom = function(gplot, type, ...) { | |
| func_name = paste0("geom_", type) | |
| args = list(...) | |
| g = do.call(func_name, args = args) | |
| gplot + g | |
| } | |
| # NAs break the line. Use na.rm = T to suppress the warning message |
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
| ############################## | |
| # | |
| ############################## | |
| rm(list=ls()) | |
| library(matrixStats) | |
| library(RNifti) | |
| ensure_Nifti = function(x) { | |
| if (is.list(x)) { | |
| x = lapply(x, ensure_Nifti) |
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
| [1] "1.1.383" | |
| $R | |
| [1] "/usr/local/bin/R" | |
| $pdflatex | |
| [1] "/Library/TeX/texbin/pdflatex" | |
| $bibtex | |
| [1] "/Library/TeX/texbin/bibtex" |
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(bibtex) | |
| x = "@article{shou2013quantifying, | |
| title={Quantifying the reliability of image replication studies: the image intraclass correlation coefficient (I2C2)}, | |
| author={Shou, H and Eloyan, A and Lee, S and Zipunnikov, V and Crainiceanu, AN and Nebel, MB and Caffo, B and Lindquist, MA and Crainiceanu, CM}, | |
| journal={Cognitive, Affective, & Behavioral Neuroscience}, | |
| volume={13}, | |
| number={4}, | |
| pages={714--724}, | |
| year={2013}, | |
| publisher={Springer} |
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(lubridate) | |
| rdate <- function(size, | |
| min = paste0(format(Sys.Date(), '%Y'), '-01-01'), | |
| max = paste0(format(Sys.Date(), '%Y'), '-12-31'), | |
| sort = TRUE) { | |
| dates <- sample( | |
| seq(as.Date(min), as.Date(max), by = "day"), | |
| size = size, replace = TRUE) |
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
| rm(list=ls()) | |
| # devtools::install_github("metacran/crandb") | |
| library(crandb) | |
| # pack = package("fftw") | |
| # sysreq = pack$SystemRequirements | |
| library(magrittr) | |
| DB <- function(api, head = 1e6, tail = head) { |
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
| all_examples = function(path = ".", commentDontrun = FALSE) { | |
| # list all the Rd files | |
| files = list.files( | |
| path = file.path(path, "man"), | |
| pattern = "Rd$", | |
| recursive = FALSE, | |
| full.names = TRUE) | |
| tfiles = sapply(files, function(x) { | |
| tfile = tempfile(fileext = ".R") | |
| # turn to examples |
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
| source ~/.R/Makevars | |
| export CXX=clang++ | |
| export CC=clang | |
| cd .. | |
| travis_wait 100 R CMD build ANTsRCore ${R_BUILD_ARGS} | |
| PKG_FILE_NAME=$(ls -1t *.tar.gz | head -n 1) | |
| if [[ ${#TRAVIS_TAG} -eq 0 ]]; | |
| then | |
| travis_wait 100 R CMD check ${R_CHECK_ARGS} "${PKG_FILE_NAME}" --no-manual; | |
| fi # --as-cran |
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
| export RGL_USE_NULL=TRUE | |
| cmake_version="3.11" | |
| ants_user=stnava | |
| wget -O antsr_travis.sh http://bit.ly/antsr_travis_sh | |
| chmod +x antsr_travis.sh | |
| source ./antsr_travis.sh | |
| rm antsr_travis.sh | |