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
--- | |
--- | |
title: "`r sprintf('Exam Questions%s', ifelse(params$solutions, ' and Solutions', ''))`" | |
author: "" | |
date: "" | |
output: pdf_document | |
params: | |
solutions: 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(ggplot2) | |
library(reshape2) | |
CorHeatmap <- function(corr.mat) { | |
# Get lower triangle of the correlation matrix | |
get_lower_tri<-function(cormat){ | |
cormat[upper.tri(cormat)] <- NA | |
return(cormat) | |
} | |
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
par(mar=c(0,0,0,0)) | |
plot(x, dbeta(x,shape1=4, shape2=4), | |
type = "l", | |
ylim = c(0,4), | |
bty = "n", | |
xaxt = "n", | |
yaxt = "n", | |
xlab = "", | |
ylab = "", |
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
#### Simulation running/monitoring script | |
#### | |
#### Run this as: ./runSim.sh YOUR_R_SOURCE_FILE.R ANY_TEXT_FILE.txt | |
#### | |
#### Lines to edit before running are indicated by '##### **' | |
RFILE="$1" | |
OUTFILE="$2" | |
nohup nice -10 R --vanilla --slave < $RFILE > $OUTFILE & ## Defaults to running at medium-low priority (-10). Can increase this to improve performance (maybe). |
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(RSQLite) | |
filename <- "your_db_file.db" | |
sqlite.driver <- dbDriver("SQLite") | |
db <- dbConnect(sqlite.driver, | |
dbname = filename) | |
## Some operations | |
dbListTables(db) | |
mytable <- dbReadTable(db,"your_table_name") |