# NOT RUN {
## Prepare the radial data for analysis
radialData <- read.csv(system.file("extdata/radial.csv", package="memgene"))
radialGen <- radialData[, -c(1,2)]
radialXY <- radialData[, 1:2]
if (require(adegenet)) {
radialDM <- codomToPropShared(radialGen)
} else {
stop("adegenent package required to produce genetic distance matrix in example.")
}
## Run the MEMGENE analysis
radialAnalysis <- mgQuick(radialDM, radialXY)
## Visualize the first two MEMGENE variables side-by-side
mgMap(radialXY, radialAnalysis$memgene[, 1:2])
## Visualize the first MEMGENE variable superimposed over a raster map
## with the same coordinate system, AND include a legend
if (require(raster)) {
resistanceMap <- raster(system.file("extdata/radial.asc", package="memgene"))
plot(resistanceMap, legend=FALSE)
mgMap(radialXY, radialAnalysis$memgene[, 1], add.plot=TRUE, legend=TRUE)
} else {
mgMap(radialXY, radialAnalysis$memgene[, 1], legend=TRUE)
}
# }
Run the code above in your browser using DataLab