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
# make sure we have latest version of BiocManager | |
renv::install("BiocManager") | |
# read lockfile records | |
lockfile <- renv:::renv_lockfile_read("renv.lock") | |
records <- lockfile$Packages | |
# keep only packages from Bioconductor | |
bioc <- Filter(function(record) { | |
record$Source == "Bioconductor" |
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
# sensitivity >=0.9, specificity >= 0.8 | |
# 80% power, 5% prevalence | |
library(MKmisc) | |
power.diagnostic.test(sens = 0.95, delta = 0.05, power = 0.8, prev = 0.05) | |
power.diagnostic.test(spec = 0.9, delta = 0.1, power = 0.8, prev = 0.05) |
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
# 1a. Download R to shared directory | |
cd /share/data/apps/R | |
wget https://cran.r-project.org/src/base/R-3/R-3.5.0.tar.gz | |
tar -zxvf R-3.5.0.tar.gz | |
# 1b. Try to configure R, but fails due to outdated libraries | |
cd R-3.5.0 | |
./configure F77=gfortran --enable-R-shlib --enable-memory-profiling | |
# 2. Download and compile zlib |
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
# In current R version ---------------------------------------------------- | |
# install.packages("sessioninfo") | |
# Save info of installed packages from current R version | |
ip <- rownames(installed.packages(priority = "NA")) | |
# Save full metadata for packages with all dependencies available | |
pkg_info <- sessioninfo::package_info(pkgs = ip) | |
pkg_info$repository <- vapply(strsplit(pkg_info$source, " \\("), `[`, character(1), 1) |
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
# Load packages | |
library(tidyverse) | |
library(caret) | |
library(microbenchmark) | |
library(splendid) | |
# Setup data | |
data(hgsc) | |
data <- hgsc | |
class <- as.factor(attr(hgsc, "class.true")) |
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) | |
library(measurements) | |
library(lubridate) | |
#' @param speed speed on treadmill | |
#' @param distance kilometres | |
get_racetime <- function(speed = 7.5, distance = 5) { | |
real_speed <- | |
as.numeric(as.period( | |
period(minute = 8, second = 0) - (speed - 7.5) * 10 * seconds(7), |