View source: R/plot_training_df_moran.R
plot_training_df_moran | R Documentation |
Plots the the Moran's I test of the response and the predictors in a training data frame.
plot_training_df_moran( data = NULL, dependent.variable.name = NULL, predictor.variable.names = NULL, distance.matrix = NULL, distance.thresholds = NULL, fill.color = viridis::viridis(100, option = "F", direction = -1), point.color = "gray30" )
data |
Data frame with a response variable and a set of predictors. Default: |
dependent.variable.name |
Character string with the name of the response variable. Must be in the column names of |
predictor.variable.names |
Character vector with the names of the predictive variables. Every element of this vector must be in the column names of |
distance.matrix |
Squared matrix with the distances among the records in |
distance.thresholds |
Numeric vector, distances below each value are set to 0 on separated copies of the distance matrix for the computation of Moran's I at different neighborhood distances. If |
fill.color |
Character vector with hexadecimal codes (e.g. "#440154FF" "#21908CFF" "#FDE725FF"), or function generating a palette (e.g. |
point.color |
Character vector with a color name (e.g. "red4"). Default: |
A ggplot2 object.
if(interactive()){ #load example data data(plant_richness_df) data(distance_matrix) #plot Moran's I of training data plot_moran_training_data( data = plant_richness_df, dependent.variable.name = "richness_species_vascular", predictor.variable.names = colnames(plant_richness_df)[5:21], distance.matrix = distance_matrix, distance.thresholds = c( 0, 2000, 4000, 6000, 8000 ) ) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.