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
function RawBlock (raw) | |
local caption = raw.text:match("\\caption%{[^%}]+%}") | |
if caption then | |
captions:insert(caption) | |
end | |
end | |
function Pandoc (doc) | |
-- append collected captions at the end | |
doc.meta.figures = captions -- This works but latex is escaped by \textbackslash |
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(stringr) | |
library(dplyr) | |
check_logfile <- ... | |
readLines(check_logfile) %>% paste(collapse = '\n') %>% | |
str_extract_all("[\\w_]+ ?:( <anonymous>:)?[\\s\\n]+no[\\s\\n]+visible[\\s\\n]+binding[\\s\\n]+for[\\s\\n]+global[\\s\\n]+variable[\\s\\n]+‘.*’") %>% | |
lapply(function(x) { | |
fun <- str_extract(x, '^[\\w_]+') | |
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(shiny) | |
print(paste('Inline Julia pID:', sys::exec_background('nohup', c("julia", "-e sleep(3000)")))) | |
print(paste('Julia script pID:', sys::exec_background('nohup', c("julia", "test.jl", "&")))) | |
# Define UI for application that draws a histogram | |
ui <- fluidPage( | |
# Application title | |
titlePanel("Old Faithful Geyser Data"), |
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
#' Extract ctree rules. | |
#' | |
#' Extract the tree rules, optionally formatting them in order to be ready to | |
#' use for data filtering. | |
#' | |
#' @param tree An object produced by \code{partikit::ctree()}. | |
#' @param rule.as.text Whether to collapse rule conditions into a string or | |
#' leave them as a character vector. | |
#' @param eval.ready Whether to format rules in order to be easily eval() for | |
#' data filtering. Turns \code{rule.as.text} automatically on. |
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
brms.mod.nprest.nb <<- brm(bf(N.prest ~ Mesi + (Mesi|Context), family = negbinomial()), data = TdA, prior = c( | |
set_prior('normal(0, 2.5)', class = 'Intercept'), | |
set_prior("cauchy(0, 2.5)", class = 'b')#, | |
#set_prior("normal(0, 2.5)", class = 'sd') | |
), init_r = 0.1, cores = 8, chains = 8, iter = 8000, warmup = 2000, control = list(max_treedepth = 15, adapt_delta = .90)) |
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
brms.mod.attesa.prior <- brm(bf(Attesa ~ log(N.prest) + (log(N.prest)|Context), shape ~ log(N.prest) + (log(N.prest)|Context), family = Gamma('log')), data = TdA, prior = c( | |
set_prior('normal(0, 2.5)', class = 'Intercept'), | |
set_prior("cauchy(0, 2.5)", class = 'b'), | |
set_prior("normal(0, 1.5)", class = 'sd', group = 'Context'), | |
set_prior("normal(0, 1.5)", class = 'sd'), | |
set_prior("student_t(3, 0, 2.5)", class = 'sd', dpar = 'shape'), | |
set_prior("student_t(3, 0, 2.5)", class = 'sd', group = 'Context', dpar = 'shape') | |
), init_r = 0.1, cores = 8, chains = 8, iter = 8000, warmup = 2000, control = list(max_treedepth = 15, adapt_delta = .90)) | |
Error in stan_base_prior(prior) : length(base_prior) == 1L is not 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
library(parallel) | |
library(pbmcapply) | |
library(dplyr) | |
mcdo <- function(.data, ...) { | |
if (progress.bar) { | |
pkg.require(c('pbmcapply')) | |
pfun <- pbmclapply | |
} else pfun <- mclapply |
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
<div style=" | |
position: relative; | |
"> | |
<span style=" | |
position: absolute; | |
top: -900%; | |
left: 3%; | |
background: white; | |
padding: 0 10px; | |
">Blah Blah</span> |