Webinar: https://youtu.be/dXCyCAgviZY?t=411
Email: help a-tea cscs.ch
| # Courtesy of Miles McBain https://milesmcbain.xyz/hacking-r-library-paths | |
| set_lib_paths <- function(lib_vec) { | |
| lib_vec <- normalizePath(lib_vec, mustWork = TRUE) | |
| shim_fun <- .libPaths | |
| shim_env <- new.env(parent = environment(shim_fun)) | |
| shim_env$.Library <- character() | |
| shim_env$.Library.site <- character() |
Webinar: https://youtu.be/dXCyCAgviZY?t=411
Email: help a-tea cscs.ch
| prob <- 0.1 | |
| len_z <- 1000 | |
| z <- rbinom(n = len_z, 1, prob) | |
| n <- 1000 | |
| z_mat <- matrix(nrow = n, ncol = len_z) | |
| for(i in 1:n){ | |
| for(s in 1:len_z){ | |
| oldz <- z[s] |
Note: These instructions work on a system running Debian (GNU + Linux) with the Gnome Desktop Environment.
| # R hacks that are cool ------ | |
| ## Function to create list with default elements | |
| list_defaults <- function( | |
| a = 1, | |
| b = 3, | |
| c = "lsa"){ |
| # For empirical posterior plots. Put the true values, repeated at the bottom two rows of the data. | |
| require(datasets) | |
| data("swiss") | |
| require(GGally) | |
| require(ggplot2) | |
| input_swiss <- rbind(swiss[,1:4], c(75, 60, 10, 15), c(75, 60, 10, 15)) | |
| my_low <- function(data, mapping, ...){ |
| library(queuecomputer) | |
| arrivals <- cumsum(rexp(1e4)) | |
| service <- rexp(1e4, 0.6) | |
| max_wait <- rexp(1e4, 0.01) | |
| reneg <- TRUE | |
| angry_output <- c() | |
| import rpy2 | |
| import rpy2.robjects as robjects | |
| import numpy | |
| # python3 to R ---------------------------- | |
| py_base_list_x = [1,6] | |
| py_base_array_x = (1,6) | |
| R_base_numeric_x = rpy2.robjects.vectors.FloatVector(py_base_list_x) |