inst/doc/AFLP.R

### R code from vignette source 'AFLP.Rnw'
### Encoding: UTF-8

###################################################
### code chunk number 1: foo
###################################################
library(AFLP)
options(width = 60)
options(str = strOptions(strict.width = "cut"))
foo <- packageDescription("AFLP")


###################################################
### code chunk number 2: reading data
###################################################
data(TiliaDesign)
str(TiliaDesign)
summary(TiliaDesign)
Tilia <- as.AFLP(TiliaDesign)


###################################################
### code chunk number 3: adding fluorescence data from SAGA
###################################################
Tilia <- readSAGA(
  system.file("extdata", "Tilia_bandvaluespc1", package = "AFLP"), 
  add.to = Tilia)
str(fluorescence(Tilia))
summary(fluorescence(Tilia))


###################################################
### code chunk number 4: AFLP.Rnw:84-85 (eval = FALSE)
###################################################
## fluorescence(Tilia) <- Your.data.frame


###################################################
### code chunk number 5: clean run
###################################################
Tilia <- clean(Tilia)
output <- normalise(Tilia, output = "none") 


###################################################
### code chunk number 6: normalise display (eval = FALSE)
###################################################
## output <- normalise(Tilia, output = "tex", device = "png")


###################################################
### code chunk number 7: normalise run
###################################################
output <- normalise(Tilia, output = "tex", device = "png")


###################################################
### code chunk number 8: remove outliers from replicates
###################################################
#extra the outliers for the replicates from the 
#AFLP.outlier object in the output
repOutliers <- replicates(output$outliers)
#select the 3 lowest effects for PC1
toRemove <- head(subset(repOutliers, PC == "PC1"), 3)
toRemove
#no outliers in the Tilia dataset
replicates(outliers(Tilia))
Tilia <- addOutliers(Tilia, toRemove)
#the outliers are added
replicates(outliers(Tilia))


###################################################
### code chunk number 9: normalise display 2 (eval = FALSE)
###################################################
## output <- normalise(Tilia, output = "tex", device = "png")


###################################################
### code chunk number 10: normalise run 2
###################################################
output <- normalise(Tilia, output = "tex", device = "png")


###################################################
### code chunk number 11: classify display (eval = FALSE)
###################################################
## Tilia <- output$data
## Tilia <- classify(Tilia, output = "tex", device = "png")


###################################################
### code chunk number 12: classify run
###################################################
Tilia <- output$data
Tilia <- classify(Tilia, output = "tex", device = "png")


###################################################
### code chunk number 13: repeat display (eval = FALSE)
###################################################
## output <- repeatability(Tilia, output = "tex", device = "png")


###################################################
### code chunk number 14: repeat run
###################################################
output <- repeatability(Tilia, output = "tex", device = "png")


###################################################
### code chunk number 15: AFLP.Rnw:228-236
###################################################
data(TiliaDesign)
library(xtable)
SpecList <- unique(TiliaDesign[, c("Group", "Specimen")])
SpecList <- aggregate(
  SpecList[, "Specimen", drop = FALSE], 
  by = SpecList[, "Group", drop = FALSE], 
  FUN = length)
print(xtable(SpecList, caption = "Number of specimen per group."), include.rownames = FALSE, label = "tab:TiliaN")

Try the AFLP package in your browser

Any scripts or data that you put into this service are public.

AFLP documentation built on May 2, 2019, 6:13 p.m.