Difference between revisions of "OR1Expt.R"
From Organic Design wiki
Line 1: | Line 1: | ||
{{perl}} {{#security: Sven,Goldfinger}} | {{perl}} {{#security: Sven,Goldfinger}} | ||
− | + | if (.Platform$OS.type == 'unix' ) { | |
+ | sourceDir <- "/Volumes/HD2/Clinton/Data" | ||
+ | } else { | ||
+ | sourceDir <- "C:/DATA/2007" | ||
+ | } | ||
+ | filename <- dir(sourceDir, pattern="OR1.+\.txt") | ||
+ | |||
+ | # Check file path | ||
+ | cat("Filename is:" ,sep="\n") | ||
+ | cat(filename, sep="\n") | ||
+ | cat("Full path is:", sep="\n") | ||
+ | cat(file.path(sourceDir, filename), sep="\n") | ||
− | |||
− | |||
dset <- read.table(file.path(sourceDir, filename), sep="\t", header=TRUE) | dset <- read.table(file.path(sourceDir, filename), sep="\t", header=TRUE) | ||
Line 33: | Line 42: | ||
# help(xyplot), help(panel.superpose) | # help(xyplot), help(panel.superpose) | ||
− | xyplot( RE ~ AM, data=dset) | + | xyplot( RE ~ AM, data=dset)#, key=mykey) |
− | xyplot( RE ~ Timepoint| AM | + | |
+ | # help(simpleKey) | ||
+ | mykey <- simpleKey(text=paste("Amount =",unique(dset$Amount)), space="top", columns=3) | ||
+ | xyplot( RE ~ Timepoint| Treatment * AM, data=dset, panel.superpose=dset$Amount, groups=Amount, key=mykey) | ||
# Anova example | # Anova example |
Revision as of 23:34, 7 May 2007
Our Perl scripts. {{#security: Sven,Goldfinger}} if (.Platform$OS.type == 'unix' ) {
sourceDir <- "/Volumes/HD2/Clinton/Data"
} else {
sourceDir <- "C:/DATA/2007"
} filename <- dir(sourceDir, pattern="OR1.+\.txt")
- Check file path
cat("Filename is:" ,sep="\n") cat(filename, sep="\n") cat("Full path is:", sep="\n") cat(file.path(sourceDir, filename), sep="\n")
dset <- read.table(file.path(sourceDir, filename), sep="\t", header=TRUE)
dim(dset) summary(dset)
- ----------------------------- Dataset variables ----------------------------- #
- Amount = 1,2,5 mu/g ingestion/injection
- Timepoint = 1,2,3,4 days
- Treatment OR1 gene/Sucrose control
- AM = Administration method; feeding or injection
- Response = RE (relative expression)
- Took each treatment, prescribed an amount and feed/injected catapillars at
- time 0. Adult moths were distructively assessed 1,2,3,4 days after emergence.
- No catapillars were harmed during this experiment!
- ~.~.~ Note: Sucrose control was only administered at Amount=1 ~.~.~
- Convert names
colnames(dset)[4:5] <- c("AM","RE")
library(lattice)
- Formulas
- y ~ x
- y ~ x | z
- y ~ x | (z * w)
- help(xyplot), help(panel.superpose)
xyplot( RE ~ AM, data=dset)#, key=mykey)
- help(simpleKey)
mykey <- simpleKey(text=paste("Amount =",unique(dset$Amount)), space="top", columns=3) xyplot( RE ~ Timepoint| Treatment * AM, data=dset, panel.superpose=dset$Amount, groups=Amount, key=mykey)
- Anova example
- help(aov), help(summary)
aovobj <- aov(RE ~ AM*Treatment, data=dset) summary(aovobj)