OR1Expt.R

From Organic Design wiki
Revision as of 23:34, 7 May 2007 by Sven (talk | contribs)

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")

  1. 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)

  1. ----------------------------- Dataset variables ----------------------------- #
  2. Amount = 1,2,5 mu/g ingestion/injection
  3. Timepoint = 1,2,3,4 days
  4. Treatment OR1 gene/Sucrose control
  5. AM = Administration method; feeding or injection
  6. Response = RE (relative expression)
  1. Took each treatment, prescribed an amount and feed/injected catapillars at
  2. time 0. Adult moths were distructively assessed 1,2,3,4 days after emergence.
  3. No catapillars were harmed during this experiment!
  4. ~.~.~ Note: Sucrose control was only administered at Amount=1 ~.~.~
  1. Convert names

colnames(dset)[4:5] <- c("AM","RE")

library(lattice)

  1. Formulas
  2. y ~ x
  3. y ~ x | z
  4. y ~ x | (z * w)
  1. help(xyplot), help(panel.superpose)

xyplot( RE ~ AM, data=dset)#, key=mykey)

  1. 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)

  1. Anova example
  2. help(aov), help(summary)

aovobj <- aov(RE ~ AM*Treatment, data=dset) summary(aovobj)