# create the dataset
mydepth <- matrix(sample(100, 16), nrow = 4, ncol = 4,
dimnames = list(paste("taxon", 1:4, sep = ""),
paste("loc", c(1,1,2,2), "_", c(0,1,0,1), sep = "")))
mydata <- RADdata(mydepth, c(1L,1L,2L,2L),
data.frame(row.names = c("loc1", "loc2"), Chr = c(1,1),
Pos = c(2000456, 5479880)),
list(2, c(2,2)), 0.001, c("A", "G", "G", "T"))
# inspect the dataset
mydata
mydata$alleleDepth
mydata$locDepth
mydata$depthRatio
# the S3 class structure is flexible; other data can be added
mydata$GPS <- data.frame(row.names = attr(mydata, "taxa"),
Lat = c(43.12, 43.40, 43.05, 43.27),
Long = -c(70.85, 70.77, 70.91, 70.95))
mydata$GPS
# If you have NA in your alleleDepth matrix to indicate zero reads,
# perform the following before running the RADdata constructor:
mydepth[is.na(mydepth)] <- 0L
# plotting a RADdata object
plot(mydata)
Run the code above in your browser using DataLab