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
# rm(list=ls()) | |
convert_index <- function(infile="index_original.html", outfile = "index.html"){ | |
trim <- function (x) gsub("^\\s+|\\s+$", "", x) | |
ff <- file(infile) | |
dat <- readLines(ff) | |
close(ff) | |
where.scene <- which(dat == " r0 = new X.renderer('r0');") |
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
#!/bin/bash | |
echo "I ran a script" > blah.txt | |
sudo apt-get update | |
sudo apt-get install -y --no-install-recommends \ | |
file \ | |
git \ | |
libapparmor1 \ | |
libgc1c2 \ |
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
better_fetch_pubmed_data = function (pubmed_id_list, retstart = 0, retmax = 500, format = "xml", | |
encoding = "UTF8") | |
{ | |
myIDlist <- pubmed_id_list | |
if ((!is.list(myIDlist)) | is.na(myIDlist$WebEnv) | is.na(myIDlist$QueryKey) | | |
is.na(myIDlist$Count) | !is.integer(as.integer(retstart)) | | |
!is.integer(as.integer(retmax))) { | |
message("There is an issue with the PubMed ID list you supplied. Please, call the function again and supply the result of a <get_pubmed_ids()> call as argument. Thank you.") | |
return(NULL) | |
} |
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
old_package_version = function(repos = getOption("repos")) { | |
all_info = vector(mode = "list", length = length(repos)) | |
names(all_info) = repos | |
for (repo in repos) { | |
# taken from remotes:::package_find_archives | |
archive <- tryCatch({ | |
tf <- tempfile(fileext = ".gz") | |
on.exit(unlink(tf), add = TRUE) | |
remotes:::download(tf, sprintf("%s/src/contrib/Meta/archive.rds", | |
repo)) |
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(xml2) | |
library(sf) | |
library(geojsonio) | |
url = "http://www.landxml.org/webapps/landxmlsamples.aspx" | |
url_file = paste0("http://landxml.org/schema/LandXML-2.0/", | |
"samples/Carlson%20Software/nunosurf.xml") | |
xml_file = file.path("~/Downloads", basename(url_file)) | |
if (!file.exists(xml_file)) { |
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
# remotes::install_github('muschellij2/knitr') | |
library(knitr) | |
rmd_to_df = function(file) { | |
x = xfun::read_utf8(file) | |
on.exit(knitr::knit_code$restore(), add = TRUE) | |
res = knitr:::split_file(x, patterns = knitr::all_patterns$md) | |
classes = sapply(res, attr, "class") | |
blocks = res[classes %in% "block"] | |
params = lapply(blocks, function(el) { |
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
read_mat = function(mat) { | |
L = try({ | |
R.matlab::readMat(mat) | |
}) | |
if (!inherits(L, "try-error")) { | |
return(L) | |
} | |
names = rhdf5::h5ls(mat)$name | |
convert_mat_string = function(x) { |
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
walk_source <- function( | |
file = NULL, | |
delay = 1.5, | |
clear_each_cmd = TRUE, | |
wait_for_press = TRUE, | |
style = styler::tidyverse_style, | |
record_screen = TRUE, | |
... | |
) { | |
if (record_screen) { |
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
file_exists = function(...) { | |
x = list(...) | |
x = unlist(...) | |
x = unname(x) | |
df = data.frame(x = x, | |
bn = basename(x), | |
dn = dirname(x), | |
index = 1:length(x), | |
stringsAsFactors = FALSE) | |
dn = unique(df$dn) |
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
/* BET - Brain Extraction Tool | |
BETv1 Steve Smith | |
BETv2 Mickael Pechaud, Mark Jenkinson, Steve Smith | |
FMRIB Image Analysis Group | |
Copyright (C) 1999-2006 University of Oxford */ | |
/* Part of FSL - FMRIB's Software Library |
NewerOlder