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(shiny) | |
# MODULES ---------------------------------------------------------------------- | |
text_ui <- function(id) { | |
ns <- shiny::NS(id) | |
shiny::tagList( | |
textInput(ns("text"), "Write here"), | |
verbatimTextOutput(ns("display")) | |
) |
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
<?php | |
//Quotes: Replace smart double quotes with straight double quotes. | |
//ANSI version for use with 8-bit regex engines and the Windows code page 1252. | |
preg_replace('[\x84\x93\x94]', '"', $text); | |
//Quotes: Replace smart double quotes with straight double quotes. | |
//Unicode version for use with Unicode regex engines. | |
preg_replace('[\u201C\u201D\u201E\u201F\u2033\u2036]', '"', $text); |
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
# install from https://github.com/jonathanbratt/RBERT | |
library(RBERT) | |
# |- Python ---- | |
reticulate::use_condaenv("r-tensorflow-1.11") | |
reticulate::py_config() | |
# |- model ---- | |
# path to downloaded BERT checkpoint | |
BERT_PRETRAINED_DIR <- file.path( |
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
# |- table.express ---- | |
library(tidyverse) | |
library(data.table) | |
library(brms) | |
library(broom) | |
# plot theme | |
theme_set(theme_dark() + | |
theme(legend.position = "none", | |
panel.grid = element_blank(), |
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
# https://www.johnmackintosh.com/2019-06-30-datatable-by-a-dummy/ | |
# |- install latest version of table.express ---- | |
devtools::install_github('asardaes/table.express') | |
# |- load library ---- | |
library(dplyr) | |
library(table.express) | |
library(data.table) |
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
# https://stackoverflow.com/questions/20519431/finding-point-of-intersection-in-r | |
set.seed(1) | |
x1=rnorm(100,0,1) | |
x2=rnorm(100,1,1) | |
# Find points where x1 is above x2. | |
above<-x1>x2 | |
# Points always intersect when above=TRUE, then FALSE or reverse | |
intersect.points<-which(diff(above)!=0) | |
# Find the slopes for each line segment. |
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
# https://datashoptalk.com/dashboard-feedback-for-missing-packages-using-inline-terr/ | |
# In text area, insert Calculated Value control in <p></p> tag | |
<h3>Installed Packages</h3> | |
<p>List of missing required packages for this analysis:</P> | |
<p> | |
<SpotfireControl id="e96d46e334a9400c86485e41f584ff82" /> | |
</p> | |
<p><b>Note:</b> Field will show Empty if all packages installed.</p> |
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(tidyverse) | |
data <- tibble::tribble( | |
~phase, ~fc_dt, ~oil, ~q, ~gas, ~t, ~mean, | |
"water", "4/1/2017", 4.602535714, 1.70775, 73.55432143, 1L, 10.60021233, | |
"water", "5/1/2017", 4.414064516, 5.845258065, 48.88796774, 2L, 7.86293583, | |
"water", "6/1/2017", 3.215866667, 4.149533333, 43.78976667, 3L, 6.47610122 | |
) | |
nest_data <- data %>% nest(-phase) |