This file contains hidden or 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
dir <- "F:/Tristan/OneDrive/Pictures/Camera Roll" | |
ps <- list.files(dir, "*.jpg", full.names = TRUE) | |
head(ps) | |
library(exiftoolr) | |
library(dplyr) | |
exif <- exif_read(head(ps, 2500), c("SourceFile", "CreateDate" )) | |
exif <- exif %>% | |
filter(!is.na(CreateDate)) %>% |
This file contains hidden or 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(R2jags) | |
runif(1) # Fixes "Error: object '.Random.seed' not found" | |
Y <- as.matrix(read.csv("rats.csv",header=F)) | |
N <- 30 | |
T <- 5 | |
x <- c(8.0, 15.0, 22.0, 29.0, 36.0) | |
x.bar <- mean(x) | |
rats.data <- list("Y", "x", "T", "N","x.bar") | |
rats.params <- c("tau.c", "sigma", "alpha.c","tau.alpha", "tau.beta", "beta.c", "alpha0") |
This file contains hidden or 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(rstan) | |
schools_code <- ' | |
data { | |
int<lower=0> J; // number of schools | |
real y[J]; // estimated treatment effects | |
real<lower=0> sigma[J]; // s.e. of effect estimates | |
} | |
parameters { | |
real theta[J]; | |
real mu; |
This file contains hidden or 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
#!/bin/bash | |
export R_LIBS_SITE=${R_LIBS_SITE-'/usr/lib/R-devel/lib/R/library:/usr/local/lib/R/site-library:/usr/lib/R/site-library::/usr/lib/R/library'} | |
export PATH="/usr/local/lib/R-devel/bin:$PATH" | |
R "$@" |
This file contains hidden or 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
#!/bin/sh | |
# This is the location of the source code | |
cd ~/svn/r-devel/R | |
# R_PAPERSIZE=letter \ | |
# R_BATCHSAVE="--no-save --no-restore" \ | |
# R_BROWSER=xdg-open \ | |
# PAGER=/usr/bin/pager \ | |
# PERL=/usr/bin/perl \ |
This file contains hidden or 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(lme4) | |
data.3 <- read.table("CH27PR20.txt") | |
response <- data.3$V1 | |
field <- factor(data.3$V2) | |
fert <- factor(data.3$V4) | |
irrigation <- factor(data.3$V3) | |
res3.m <- lmer(response~irrigation*fert+(1|field:irrigation)) | |
summary(res3.m) | |
51.6/(51.6+1.5) | |
anova(res3.m) |
This file contains hidden or 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
# Bottling Plant Example | |
# Factor A: Machines - 3 levels | |
# Factor B: Operators nested withing machines - 4 each | |
# Response: Cases produced | |
data <- read.csv("nested.csv") | |
attach(data) | |
machf <- factor(machine) | |
operf <- factor(operator) | |
library(lattice) |
This file contains hidden or 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(lme4) | |
oats <- read.csv("oats.csv") | |
attach(oats) | |
nitrof <- factor(nitro) | |
xyplot(yield~nitrof|variety) | |
xyplot(yield~nitrof|variety,groups=replicate) | |
xyplot(yield~nitrof|variety,groups=replicate,aspect="xy",type="o") | |
xyplot(yield~variety|nitrof,groups=replicate,aspect="xy") | |
xyplot(yield~variety|nitrof,groups=replicate,aspect="xy",type="a") |
This file contains hidden or 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
# Classic repeated measures example | |
# Finding the results of a wine tasting | |
# 3 wines, 22 judges. The judges are the repeated measure | |
data <- read.csv("wine_taste.csv") | |
attach(data) | |
interaction.plot(Wine,Taster,Taste) | |
# | |
# Naive assumptions, no repeated measures | |
# | |
res <- lm(Taste~Wine) |
This file contains hidden or 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
# | |
# Generate random beer data | |
# | |
set.seed(314159) | |
ibv <- .5 # Inner Beer Variation | |
mu.i <- rnorm(8,18,4) | |
sodium <- rnorm(6*8,mu.i,ibv) | |
beer <- rep(1:8,6) | |
plot(sodium~beer) |
NewerOlder