Scripts for creating maps and performing niche modeling in RStudio.
The general workflow is:
• mapping.R
: importing Allium canadense occurrence data into R, creating simple maps, creating customized shapefiles
• layerPrep.R
: masking/clipping PRISM layers, looking for correlations between layers
• maxent.R
: creating niche models using occurrence data and climate layers
• nicheOverlap.R
: assessing whether niche models for different varieties are distinct from each other
• creatingPermutedAlliumDatasets.R
: assessing the accuracy of identification of climatic determinants of a variaties' range
• ResponseCurves.R
: creating figures that each have multiple response curve graphs representing each environmental layers included in each model constructed
• TestGainTable.R
: creating table of of test gain values for environmental variables used in the model to determine which one is most important to the predictability of the model
There are a number of files and directories that are downloaded or created during this analysis. To perform all commands in layerPrep.R
, you should download the PRISM 1929 layers from Recent Years and the PRISM 2011 layers from Historical Past. Store them in a convenient place (note the paths for using these layers may need to be changed). Clipped layers are included in layers
for your convenience. A shapefile created in mapping.R
is included inshapefiles
for convenience. Models are included for all varieties, hybrids, and parentals for Allium canadense in models
for observation. ANOVA and Tukey's test results are included in anova_results
for observation. A temporary file is generated by Maxent after building the models, which you can find by viewing the html file and searching your computer using the last directory name within the html URL. After model is built, manually move the .dat files, from a temporary files generated by Maxent, to plots
within the specific model directory within models
. After running the for loop within ResponseCurve.R
, the resulting .csv files, that are named for each climatic variable included within the model built, were manually moved from the main project directory Allium_nicheModeling
to the specific model directory within models
. Then the second portion of the code for each taxon creates the publication–ready figures in figures
. Manually move the MaxentResults.csv file from a temporary files generated by Maxent to the specific model directory within models
. Run TestGainTable.R
to generate a test gain table that includes taxon,test AUC, and test gain values for the full model, and only for the specific environmental variables included in the model built.