We're excited to have you attend one of our workshops! Here's a JavaScript (re)fresher to help you get up-to-speed on some features of the language we'll be using.
JavaScript has always had var:
var name = 'Ryan'| args <- commandArgs(trailingOnly = TRUE) | |
| # just add the two args goether | |
| Input <- as.numeric(args[1]) + as.numeric(args[2]) | |
| jsonlite::toJSON(list(res = Input)) |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <dict> | |
| <key>fileTypes</key> | |
| <array> | |
| <string>mod</string> | |
| <string>ctl</string> | |
| <string>lst</string> | |
| </array> |
| package main | |
| import ( | |
| "fmt" | |
| "path/filepath" | |
| "sync" | |
| "time" | |
| ) | |
| import "os" |
| library(ggplot2) | |
| t1<-seq(0,40,0.2) | |
| a1<-seq(from =1, to =0, length.out = length(t1)) | |
| a2<-seq(from = 1, to = 0.4, length.out = length(t1)) | |
| a3<-seq(from = 1, to = 0.6, length.out = length(t1)) | |
| df1<-data.frame(time = t1, surv = a1) | |
| df2<-data.frame(time = t1, surv = a2) | |
| df3<-data.frame(time = t1, surv = a3) |
| ```{r} | |
| library(pbdZMQ) | |
| library(future) | |
| sim_logger <- function(rep, message = "") { | |
| context <- zmq.ctx.new() | |
| sink <- zmq.socket(context, .pbd_env$ZMQ.ST$PUSH) | |
| zmq.connect(sink, "tcp://localhost:5558") | |
| zmq.send(sink, paste("completed sim", rep, "from process", Sys.getpid(), "with message: ", message)) |
| library(future) | |
| library(mrgsolve) | |
| library(dplyr) | |
| data(extran3) | |
| ipar <- extran3 %>% dplyr::select(ID,CL,VC,KA) %>% distinct(ID) | |
| mod <- mrgsolve:::house() | |
| plan(multiprocess) | |
| f <- list() | |
| for (ii in 1:2) { |
| library(microbenchmark) | |
| library(tibble) | |
| library(future) | |
| library(dplyr) | |
| nids <- 16 | |
| sleep_times <- data_frame(REP = 1:nids, sleep_time = round(runif(nids, 0, 2), 0)) | |
| sleep_times | |
| eager_bm <- function(sleep_times) { | |
| plan(eager) |
| b = matrix(0, 2, 2) | |
| b[lower.tri(b, diag=T)] = as.numeric(c("1.23E-01", | |
| "0.00E+00", | |
| "1.54E-01")) |
| library(MASS) | |
| library(shiny) | |
| library(mrgsolve) | |
| library(dplyr) | |
| library(magrittr) | |
| library(parallel) | |
| RNGkind("L'Ecuyer-CMRG") | |
| set.seed(101) |