| Title: | Multidimensional Analysis of Phenotypic Plasticity in Eco-Evolutionary Contexts |
|---|---|
| Description: | Provides novel methods for analyzing phenotypic plasticity across multiple traits and environmental variables, with special focus on insect-fungus host-pathogen systems. Implements original multidimensional plasticity indices and interaction analyses not available in other packages. |
| Authors: | Leonel Stazione [aut, cre] |
| Maintainer: | Leonel Stazione <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.0 |
| Built: | 2026-05-17 09:29:36 UTC |
| Source: | https://github.com/leonelstazione/phenop |
Calculates correlation matrix between key phenological variables.
analyze_correlations(parameters)analyze_correlations(parameters)
parameters |
A data frame containing extracted phenological parameters |
A list with correlation results
## Not run: data(pheno_parameters) corr_results <- analyze_correlations(pheno_parameters) ## End(Not run)## Not run: data(pheno_parameters) corr_results <- analyze_correlations(pheno_parameters) ## End(Not run)
Fits Generalized Additive Models to capture non-linear relationships.
analyze_gam_relationships(time_series_subset)analyze_gam_relationships(time_series_subset)
time_series_subset |
A subset of the time series data |
A GAM model object
## Not run: data(pheno_time_series) subset <- pheno_time_series[pheno_time_series$species == "Quercus_ilex", ] gam_model <- analyze_gam_relationships(subset) ## End(Not run)## Not run: data(pheno_time_series) subset <- pheno_time_series[pheno_time_series$species == "Quercus_ilex", ] gam_model <- analyze_gam_relationships(subset) ## End(Not run)
Fits mixed effects models to analyze phenological timing.
analyze_mixed_effects(parameters)analyze_mixed_effects(parameters)
parameters |
A data frame containing extracted phenological parameters |
A list with model results
## Not run: data(pheno_parameters) results <- analyze_mixed_effects(pheno_parameters) ## End(Not run)## Not run: data(pheno_parameters) results <- analyze_mixed_effects(pheno_parameters) ## End(Not run)
Calculates linear trends in phenological parameters over years.
analyze_temporal_trends(parameters)analyze_temporal_trends(parameters)
parameters |
A data frame containing extracted phenological parameters |
A data frame with trend statistics
## Not run: data(pheno_parameters) trends <- analyze_temporal_trends(pheno_parameters) ## End(Not run)## Not run: data(pheno_parameters) trends <- analyze_temporal_trends(pheno_parameters) ## End(Not run)
Performs ANOVA to test genotype-environment interactions and phenotypic plasticity significance.
anova_plasticity(formula, data, return_type = "anova")anova_plasticity(formula, data, return_type = "anova")
formula |
A formula specifying the model (e.g., trait ~ genotype * environment) |
data |
A data frame containing the variables |
return_type |
Type of output: "anova" (default), "model", or "summary" |
ANOVA table, model object, or summary depending on return_type
# Using the example data from calcular_ip example_data <- data.frame( genotype = rep(LETTERS[1:5], each = 4), environment = rep(c("Low", "High"), each = 2, times = 5), trait_value = rnorm(20, 10, 2) ) anova_plasticity(trait_value ~ genotype * environment, example_data)# Using the example data from calcular_ip example_data <- data.frame( genotype = rep(LETTERS[1:5], each = 4), environment = rep(c("Low", "High"), each = 2, times = 5), trait_value = rnorm(20, 10, 2) ) anova_plasticity(trait_value ~ genotype * environment, example_data)
Generates a comprehensive dashboard with multiple phenological visualizations.
create_phenology_dashboard( time_series, parameters, spatial_data, selected_year = 2021 )create_phenology_dashboard( time_series, parameters, spatial_data, selected_year = 2021 )
time_series |
Time series data |
parameters |
Extracted parameters data |
spatial_data |
Spatial data |
selected_year |
Year for seasonal curves (default: 2021) |
A patchwork object combining multiple plots
Dataset simulated que contiene medidas fenotípicas de interacciones insecto-hongo
datos_demodatos_demo
Un data.frame con 200 observaciones y 8 variables:
Población de insecto (P1, P2, P3, P4)
Cepa de hongo (C1, C2, C3)
Temperatura en °C
Humedad en %
Tamaño del insecto en mm
Resistencia del insecto
Crecimiento del hongo
Virulencia del hongo
Simulated data para el paquete phenop
data(datos_demo) head(datos_demo)data(datos_demo) head(datos_demo)
Simulated dataset containing insect and fungus data to demonstrate phenop package functionalities.
demo_datademo_data
A data.frame with 200 rows and 8 columns:
Insect population (P1, P2, P3)
Fungus strain (C1, C2, C3)
Temperature in Celsius (15-30)
Relative humidity in percentage (40-80)
Insect size in mm (mean 10, sd 2)
Insect resistance to infection (mean 5, sd 1)
Fungus growth rate (mean 8, sd 1.5)
Fungus virulence (mean 6, sd 1)
Simulated data for demonstration purposes
data(demo_data) head(demo_data)data(demo_data) head(demo_data)
Identifies anomalous observations based on z-scores and IQR methods.
detect_anomalies(parameters, threshold = 2.5)detect_anomalies(parameters, threshold = 2.5)
parameters |
A data frame containing extracted phenological parameters. Must include columns: species, site, sos, eos, los. |
threshold |
Numeric threshold for z-score anomaly detection (default = 2.5). Observations with z-scores beyond ±threshold are flagged as anomalies. |
A data frame with anomaly flags including:
sos_anomaly |
Logical flag for start-of-season anomalies |
eos_anomaly |
Logical flag for end-of-season anomalies |
los_anomaly |
Logical flag for length-of-season anomalies |
anomaly_score |
Numeric score (0-3) of total anomalies detected |
sos_z, eos_z, los_z
|
Z-scores for each parameter |
## Not run: data(pheno_parameters) anomalies <- detect_anomalies(pheno_parameters) anomalies_strict <- detect_anomalies(pheno_parameters, threshold = 3.0) ## End(Not run)## Not run: data(pheno_parameters) anomalies <- detect_anomalies(pheno_parameters) anomalies_strict <- detect_anomalies(pheno_parameters, threshold = 3.0) ## End(Not run)
Simulated dataset of phenotypic plasticity in a fungus-insect host-pathogen system. Contains data for 20 fungus strains across 10 insect populations under different temperature and humidity conditions.
fungi_insect_datafungi_insect_data
A data frame with 600 rows and 8 variables:
Fungus strain identifier (H1-H20)
Insect population identifier (I1-I10)
Environmental temperature in °C (15-35)
Relative humidity in percent (30, 60, 90)
Fungus growth rate
Fungus virulence (0-1 scale)
Insect body size
Insect resistance to fungus (0-1 scale)
Simulated data for package examples and testing
Calculates basic plasticity metrics for host-pathogen comparisons. Robust alternative that calculates plasticity metrics without errors.
host_pathogen_interaction( data, host_trait, pathogen_trait, environment, host_group = "insect_population", pathogen_group = "fungus_strain" )host_pathogen_interaction( data, host_trait, pathogen_trait, environment, host_group = "insect_population", pathogen_group = "fungus_strain" )
data |
Data frame with both host and pathogen data |
host_trait |
Host trait name |
pathogen_trait |
Pathogen trait name |
environment |
Environmental variable name |
host_group |
Column name for host groups |
pathogen_group |
Column name for pathogen groups |
List with plasticity comparison results
data(fungi_insect_data) result <- host_pathogen_interaction( data = fungi_insect_data, host_trait = "insect_size", pathogen_trait = "fungus_growth", environment = "temperature", host_group = "insect_population", pathogen_group = "fungus_strain" )data(fungi_insect_data) result <- host_pathogen_interaction( data = fungi_insect_data, host_trait = "insect_size", pathogen_trait = "fungus_growth", environment = "temperature", host_group = "insect_population", pathogen_group = "fungus_strain" )
Comprehensive analysis of phenotypic plasticity in host-pathogen systems.
host_pathogen_interaction_extended( host_data, pathogen_data, host_traits, pathogen_traits, interaction_metrics = c("correlation"), environments, host_group = NULL, pathogen_group = NULL, infection_data = NULL, ... )host_pathogen_interaction_extended( host_data, pathogen_data, host_traits, pathogen_traits, interaction_metrics = c("correlation"), environments, host_group = NULL, pathogen_group = NULL, infection_data = NULL, ... )
host_data |
Data frame with host phenotypic data |
pathogen_data |
Data frame with pathogen phenotypic data |
host_traits |
Character vector of host trait names |
pathogen_traits |
Character vector of pathogen trait names |
interaction_metrics |
Metrics to calculate |
environments |
Environmental variables |
host_group |
Column name for host groups |
pathogen_group |
Column name for pathogen groups |
infection_data |
Optional infection data |
... |
Additional arguments |
Calculate Multidimensional Plasticity Index (MPI)
multidim_plasticity( data, traits, environments, groups, weights = NULL, na.action = "omit", min_variation = 0.01, ... )multidim_plasticity( data, traits, environments, groups, weights = NULL, na.action = "omit", min_variation = 0.01, ... )
data |
A data frame containing the phenotypic data |
traits |
Character vector of trait column names |
environments |
Character string of environment column name |
groups |
Character string of group/genotype column name |
weights |
Optional numeric vector of weights for each trait |
na.action |
How to handle NAs ("omit", "fail", "warning") |
min_variation |
Minimum variation threshold (default 0.01) |
... |
Additional arguments passed to internal functions |
A list with multidimensional_index and individual_plasticity
data(demo_data) result <- multidim_plasticity( data = demo_data, traits = c("insect_size", "resistance"), environments = "temperature", groups = "insect_population" )data(demo_data) result <- multidim_plasticity( data = demo_data, traits = c("insect_size", "resistance"), environments = "temperature", groups = "insect_population" )
Finds optimal environmental conditions considering multiple traits simultaneously using original optimization algorithms for phenotypic plasticity landscapes.
optimize_multidim_environment( data, traits, environments, groups, optimization_goal = "compromise", weights = NULL )optimize_multidim_environment( data, traits, environments, groups, optimization_goal = "compromise", weights = NULL )
data |
Data frame with phenotypic and environmental data |
traits |
Vector of trait names to optimize |
environments |
Vector of environmental variables to optimize |
groups |
Grouping variable(genotypes/populations) |
optimization_goal |
Optimization goal: "maximize", "minimize", "compromise" |
weights |
Optional weights for each trait's importance |
List with optimal conditions and optimization landscape
Groups populations based on phenological characteristics using k-means.
perform_cluster_analysis(parameters, n_clusters = 4)perform_cluster_analysis(parameters, n_clusters = 4)
parameters |
A data frame containing extracted phenological parameters |
n_clusters |
Number of clusters (default: 4) |
A list with clustering results
## Not run: data(pheno_parameters) clusters <- perform_cluster_analysis(pheno_parameters, n_clusters = 3) ## End(Not run)## Not run: data(pheno_parameters) clusters <- perform_cluster_analysis(pheno_parameters, n_clusters = 3) ## End(Not run)
Performs PCA on phenological parameters to identify main axes of variation.
perform_pca_analysis(parameters)perform_pca_analysis(parameters)
parameters |
A data frame containing extracted phenological parameters |
A PCA result object
## Not run: data(pheno_parameters) pca_results <- perform_pca_analysis(pheno_parameters) ## End(Not run)## Not run: data(pheno_parameters) pca_results <- perform_pca_analysis(pheno_parameters) ## End(Not run)
Derived phenological metrics extracted from time series analysis.
pheno_parameterspheno_parameters
A data frame with X rows and 44 variables:
Unique identifier for each parameter record
Site name or identifier where observations were made
Species name or identifier
Year of observation
Population identifier for the observed group
Number of individual observations aggregated
Start of season (day of year when growth begins)
End of season (day of year when growth ends)
Peak of season (day of year of maximum growth)
Length of season (number of days between SOS and EOS)
Maximum Normalized Difference Vegetation Index value
Minimum Normalized Difference Vegetation Index value
Difference between maximum and minimum NDVI
Mean Normalized Difference Vegetation Index value
Standard deviation of NDVI values
Coefficient of variation of NDVI values
Cumulative NDVI over the growing season
Total Gross Primary Production (cumulative)
Maximum daily Gross Primary Production
Maximum Leaf Area Index value
Rate of green-up (rate of increase in vegetation)
Rate of senescence (rate of vegetation decline)
Mean temperature during the growing season (°C)
Total precipitation during growing season (mm)
Mean Growing Degree Days
Total Growing Degree Days accumulated
Day of year when budburst occurred
Day of year when flowering occurred
Day of year when senescence began
Percentage of complete data records
Elevation above sea level (meters)
Latitude coordinate in decimal degrees
Longitude coordinate in decimal degrees
Classification of soil type
Soil pH measurement
Terrain slope in degrees
Type of phenology (e.g., early, late, etc.)
Productivity classification (low, medium, high)
Deviation of SOS from long-term average
Deviation of EOS from long-term average
Deviation of LOS from long-term average
Water use efficiency metric
Temperature use efficiency metric
Temporal trend in SOS over years
Temporal trend in EOS over years
Gridded spatial data for phenological mapping and spatial analysis.
pheno_spatialpheno_spatial
A data frame with X rows and 24 variables:
Unique identifier for the spatial site
Longitude coordinate in decimal degrees
Latitude coordinate in decimal degrees
Elevation above sea level (meters)
Mean annual temperature (°C)
Total annual precipitation (mm)
Classification of soil type
Soil pH measurement
Soil organic carbon content (g/kg)
Start of season (day of year)
End of season (day of year)
Length of season (days)
Maximum Normalized Difference Vegetation Index value
Land cover classification type
Forest type classification
Indicates if the site is in a protected area
Years since last disturbance event
Type of disturbance (fire, logging, etc.)
Climate zone classification
Phenology classification category
Productivity metric value
Productivity classification category
Number of species recorded at the site
Aboveground carbon stock (Mg/ha)
A spatial dataset containing phenological observations with geometry.
pheno_spatial_sfpheno_spatial_sf
An sf object with 150 features and 12 fields.
Unique identifier for the spatial site
Longitude coordinate in decimal degrees
Latitude coordinate in decimal degrees
Elevation above sea level (meters)
Mean annual temperature (°C)
Total annual precipitation (mm)
Classification of soil type
Soil pH measurement
Soil organic carbon content (g/kg)
Start of season (day of year)
End of season (day of year)
Length of season (days)
Maximum Normalized Difference Vegetation Index value
Land cover classification type
Forest type classification
Indicates if the site is in a protected area
Years since last disturbance event
Type of disturbance (fire, logging, etc.)
Climate zone classification
Phenology classification category
Productivity metric value
Productivity classification category
Number of species recorded at the site
Aboveground carbon stock (Mg/ha)
A comprehensive synthetic dataset of weekly phenological observations for 15 populations, 5 species, 7 sites, and 6 years (2018-2023).
pheno_time_seriespheno_time_series
A data frame with X rows and 29 variables:
Unique identifier for each observation
Population identifier
Species name or identifier
Site name or identifier
Year of observation
Date of observation (YYYY-MM-DD)
Day of year (1-365/366)
Month of observation (1-12)
Seasonal classification
Latitude coordinate in decimal degrees
Longitude coordinate in decimal degrees
Elevation above sea level (meters)
Classification of soil type
Soil pH measurement
Terrain slope in degrees
Normalized Difference Vegetation Index value
Enhanced Vegetation Index value
Gross Primary Production value
Leaf Area Index value
Temperature measurement (°C)
Precipitation measurement (mm)
Growing Degree Days accumulated
Vegetation health index value
Adjusted start of season indicator
Adjusted end of season indicator
Budburst phenophase indicator
Flowering phenophase indicator
Senescence phenophase indicator
Data quality flag
Generated synthetically for the phenop package
data(pheno_time_series) summary(pheno_time_series$ndvi) ggplot2::ggplot(pheno_time_series, ggplot2::aes(x = doy, y = ndvi)) + ggplot2::geom_line(alpha = 0.3)data(pheno_time_series) summary(pheno_time_series$ndvi) ggplot2::ggplot(pheno_time_series, ggplot2::aes(x = doy, y = ndvi)) + ggplot2::geom_line(alpha = 0.3)
Simulated data to demonstrate las funciones of the package phenop.
Un data.frame con 200 observaciones y 6 variables.
Simulado
Performs meta-analysis of phenotypic plasticity studies using original methods for synthesizing effect sizes and exploring publication bias.
plasticity_meta_analysis( study_data, effect_size = "effect_size", variance = "variance", moderator = NULL, method = "random" )plasticity_meta_analysis( study_data, effect_size = "effect_size", variance = "variance", moderator = NULL, method = "random" )
study_data |
Data frame with study results (plasticity effect sizes) |
effect_size |
Column name containing effect sizes |
variance |
Column name containing variances |
moderator |
Optional moderator variables for analysis |
method |
Meta-analysis method: "fixed", "random", "multilevel" |
Meta-analysis results with original plasticity-specific metrics
Comprehensive meta-analysis of phenotypic plasticity studies. This function synthesizes effect sizes from multiple studies, assesses heterogeneity, publication bias, and moderating effects.
plasticity_meta_analysis_extended( study_data, effect_size = "effect_size", variance = "variance", study_labels = "study", method = "random", p_value_threshold = 0.05, moderator = NULL, ... )plasticity_meta_analysis_extended( study_data, effect_size = "effect_size", variance = "variance", study_labels = "study", method = "random", p_value_threshold = 0.05, moderator = NULL, ... )
study_data |
Data frame containing study results. Must include columns for effect sizes and their variances. |
effect_size |
Character string specifying the column name for effect sizes |
variance |
Character string specifying the column name for variances |
study_labels |
Character string specifying the column name for study identifiers |
method |
Meta-analysis method: "fixed" (default), "random", "bayesian", "multilevel" |
p_value_threshold |
Threshold for statistical significance (default: 0.05) |
moderator |
Optional character vector of moderator variable names |
... |
Additional arguments passed to meta-analysis functions |
A list containing:
meta_results |
Overall meta-analysis results |
individual_studies |
Study-level statistics |
heterogeneity |
Heterogeneity analysis |
publication_bias |
Publication bias assessment |
moderator_analysis |
Results of moderator analysis (if requested) |
forest_plot_data |
Data for creating forest plots |
# Create simulated meta-analysis data n_studies <- 15 meta_data <- data.frame( study = paste("Study", 1:n_studies), effect_size = rnorm(n_studies, mean = 0.6, sd = 0.3), variance = runif(n_studies, 0.05, 0.2), year = 2000 + 1:n_studies, taxon = sample(c("Insect", "Fungus", "Plant"), n_studies, replace = TRUE), trait_type = sample(c("Morphological", "Physiological", "Life History"), n_studies, replace = TRUE) ) # Run meta-analysis meta_result <- plasticity_meta_analysis_extended( study_data = meta_data, effect_size = "effect_size", variance = "variance", study_labels = "study", method = "random", moderator = c("year", "taxon", "trait_type") ) print(meta_result)# Create simulated meta-analysis data n_studies <- 15 meta_data <- data.frame( study = paste("Study", 1:n_studies), effect_size = rnorm(n_studies, mean = 0.6, sd = 0.3), variance = runif(n_studies, 0.05, 0.2), year = 2000 + 1:n_studies, taxon = sample(c("Insect", "Fungus", "Plant"), n_studies, replace = TRUE), trait_type = sample(c("Morphological", "Physiological", "Life History"), n_studies, replace = TRUE) ) # Run meta-analysis meta_result <- plasticity_meta_analysis_extended( study_data = meta_data, effect_size = "effect_size", variance = "variance", study_labels = "study", method = "random", moderator = c("year", "taxon", "trait_type") ) print(meta_result)
Identifies and quantifies trade-offs between plasticities of different traits using original correlation-based and constraint-based methods.
plasticity_tradeoffs(multidim_result, method = "correlation", threshold = -0.5)plasticity_tradeoffs(multidim_result, method = "correlation", threshold = -0.5)
multidim_result |
Result from multidim_plasticity() function |
method |
Trade-off detection method: "correlation", "pca", "constraint" |
threshold |
Threshold for significant trade-offs |
List with trade-off metrics and visualizations
Comprehensive analysis of trade-offs between different phenotypic plasticity indices. This function identifies and quantifies constraints and trade-offs in multivariate plasticity space.
plasticity_tradeoffs_extended( plasticity_result, method = "correlation", threshold = -0.5, p_value_threshold = 0.05, visualization = TRUE, ... )plasticity_tradeoffs_extended( plasticity_result, method = "correlation", threshold = -0.5, p_value_threshold = 0.05, visualization = TRUE, ... )
plasticity_result |
Result object from multidim_plasticity() or safe_multidim_plasticity() |
method |
Analysis method: "correlation" (default), "pca", "constraint", "regression" |
threshold |
Correlation threshold for identifying trade-offs (default: -0.5) |
p_value_threshold |
Significance threshold for statistical tests (default: 0.05) |
visualization |
Logical, whether to prepare data for visualization (default: TRUE) |
... |
Additional arguments passed to analysis functions |
A list containing:
tradeoff_matrix |
Matrix of correlations between plasticity indices |
significant_tradeoffs |
Data frame of significant trade-off pairs |
pca_results |
PCA results if method includes PCA |
constraint_indices |
Constraint strength indices |
visualization_data |
Data prepared for plotting |
analysis_parameters |
Parameters used in the analysis |
data(demo_data) # First run plasticity analysis insect_data <- demo_data %>% dplyr::select(insect_population, temperature, humidity, insect_size, resistance) %>% dplyr::distinct() result <- safe_multidim_plasticity( insect_data, traits = c("insect_size", "resistance"), environments = c("temperature", "humidity"), groups = "insect_population" ) # Then analyze trade-offs tradeoffs <- plasticity_tradeoffs_extended(result, method = "correlation") print(tradeoffs)data(demo_data) # First run plasticity analysis insect_data <- demo_data %>% dplyr::select(insect_population, temperature, humidity, insect_size, resistance) %>% dplyr::distinct() result <- safe_multidim_plasticity( insect_data, traits = c("insect_size", "resistance"), environments = c("temperature", "humidity"), groups = "insect_population" ) # Then analyze trade-offs tradeoffs <- plasticity_tradeoffs_extended(result, method = "correlation") print(tradeoffs)
Creates density ridge plots showing distributions of phenological parameters.
plot_density_ridges( parameters, parameter = "los", group_by = "species", title = NULL )plot_density_ridges( parameters, parameter = "los", group_by = "species", title = NULL )
parameters |
A data frame containing extracted phenological parameters |
parameter |
Name of parameter to plot (default: "los") |
group_by |
Grouping variable (default: "species") |
title |
Plot title (optional) |
A ggplot object
Internal plotting function for multidimensional plasticity
plot_internals(df, type = "integration", traits = NULL, plot_options = list())plot_internals(df, type = "integration", traits = NULL, plot_options = list())
df |
Data frame or result object |
type |
Type of plot: "integration" or "radar" |
traits |
Optional vector of traits |
plot_options |
List of plot options |
ggplot object
Creates innovative visualizations for multidimensional plasticity analysis including correlation networks, plasticity landscapes, and trait integration plots.
plot_multidim_plasticity( multidim_result, type = "network", traits = NULL, plot_options = list() )plot_multidim_plasticity( multidim_result, type = "network", traits = NULL, plot_options = list() )
multidim_result |
Result from multidim_plasticity() function |
type |
Type of plot: "network", "landscape", "integration", "radar" |
traits |
Optional: subset of traits to display |
plot_options |
Additional plotting options |
ggplot object or list of plots
# Usar demo_data en lugar de fungi_insect_data data(demo_data) # Preparar datos para multidim_plasticity result <- safe_multidim_plasticity( demo_data, traits = c("insect_size", "resistance"), environments = c("temperature", "humidity"), groups = "insect_population" ) plot_multidim_plasticity(result, "network")# Usar demo_data en lugar de fungi_insect_data data(demo_data) # Preparar datos para multidim_plasticity result <- safe_multidim_plasticity( demo_data, traits = c("insect_size", "resistance"), environments = c("temperature", "humidity"), groups = "insect_population" ) plot_multidim_plasticity(result, "network")
Advanced plotting functions for visualizing multidimensional plasticity results. Always returns a ggplot object, even if data are missing or incomplete.
plot_multidim_plasticity_extended( multidim_result, type = "heatmap", traits = NULL, plot_options = list(), ... )plot_multidim_plasticity_extended( multidim_result, type = "heatmap", traits = NULL, plot_options = list(), ... )
multidim_result |
Result object from multidim_plasticity() or safe_multidim_plasticity() |
type |
Type of plot to create. Options: "heatmap" (default), "network", "radar", "bar", "scatter", "violin", "density", "pca", "landscape", "integration" |
traits |
Optional character vector of traits to include (subset of all traits) |
plot_options |
List of additional plotting options:
|
... |
Additional arguments passed to plotting functions |
A ggplot object (or plotly object if interactive = TRUE)
Creates a heatmap showing variation in phenological parameters across species, sites, and years.
plot_parameter_heatmap( parameters, parameter = "los", title = "Phenological Parameter Variation" )plot_parameter_heatmap( parameters, parameter = "los", title = "Phenological Parameter Variation" )
parameters |
A data frame containing extracted phenological parameters |
parameter |
Name of parameter to plot (default: "los") |
title |
Plot title (optional) |
A ggplot object
Shows relationships between productivity (GPP) and climate variables.
plot_productivity_climate(parameters)plot_productivity_climate(parameters)
parameters |
A data frame containing extracted phenological parameters |
A ggplot object
Creates reaction norm plots to visualize genotype-environment interactions.
plot_reaction_norm( data, environment, trait, genotype, add_points = TRUE, add_se = TRUE )plot_reaction_norm( data, environment, trait, genotype, add_points = TRUE, add_se = TRUE )
data |
A data frame containing the phenotypic data |
environment |
Column name for environment variable(unquoted) |
trait |
Column name for phenotypic trait (unquoted) |
genotype |
Column name for genotype grouping (unquoted) |
add_points |
Whether to add individual data points (default: TRUE) |
add_se |
Whether to add standard error bars (default: TRUE) |
A ggplot object with reaction norms
datos <- data.frame( gen = rep(c("A", "B"), each = 6), env = rep(1:3, each = 2, times = 2), trait = c(10, 12, 15, 16, 20, 22, 8, 9, 12, 14, 18, 20) ) plot_reaction_norm(datos, env, trait, gen)datos <- data.frame( gen = rep(c("A", "B"), each = 6), env = rep(1:3, each = 2, times = 2), trait = c(10, 12, 15, 16, 20, 22, 8, 9, 12, 14, 18, 20) ) plot_reaction_norm(datos, env, trait, gen)
Creates multi-panel plots showing seasonal NDVI dynamics across species and sites.
plot_seasonal_curves( time_series, selected_species = NULL, selected_year = 2021, n_populations = 3 )plot_seasonal_curves( time_series, selected_species = NULL, selected_year = 2021, n_populations = 3 )
time_series |
A data frame containing phenological time series |
selected_species |
Vector of species to include (NULL for all) |
selected_year |
Year to plot (default: 2021) |
n_populations |
Number of populations to include (default: 3) |
A ggplot object
## Not run: data(pheno_time_series) plot_seasonal_curves(pheno_time_series, selected_year = 2021) ## End(Not run)## Not run: data(pheno_time_series) plot_seasonal_curves(pheno_time_series, selected_year = 2021) ## End(Not run)
Creates a spatial map showing phenological patterns across locations.
plot_spatial_map( spatial_data, variable = "los", point_size = "ndvi_max", title = "Spatial Phenology Patterns" )plot_spatial_map( spatial_data, variable = "los", point_size = "ndvi_max", title = "Spatial Phenology Patterns" )
spatial_data |
Spatial data frame (sf object or data.frame with coordinates) |
variable |
Variable to map as color (default: "los") |
point_size |
Variable to map as point size (default: "ndvi_max") |
title |
Plot title (optional) |
A ggplot object
Print method for plasticity_meta_analysis_extended
## S3 method for class 'plasticity_meta_analysis_extended' print(x, ...)## S3 method for class 'plasticity_meta_analysis_extended' print(x, ...)
x |
An object of class plasticity_meta_analysis_extended |
... |
Additional arguments passed to print |
Print method for plasticity_tradeoffs_extended
## S3 method for class 'plasticity_tradeoffs_extended' print(x, ...)## S3 method for class 'plasticity_tradeoffs_extended' print(x, ...)
x |
An object of class plasticity_tradeoffs_extended |
... |
Additional arguments passed to print |
Print method for safe_multidim_result
## S3 method for class 'safe_multidim_result' print(x, ...)## S3 method for class 'safe_multidim_result' print(x, ...)
x |
An object of class safe_multidim_result |
... |
Additional arguments passed to print |
Executes a comprehensive analysis pipeline on phenological data.
run_complete_analysis(time_series, parameters)run_complete_analysis(time_series, parameters)
time_series |
Time series data (not always used, but kept for consistency) |
parameters |
A data frame containing extracted phenological parameters |
A list with all analysis results
## Not run: data(pheno_time_series) data(pheno_parameters) results <- run_complete_analysis(pheno_time_series, pheno_parameters) ## End(Not run)## Not run: data(pheno_time_series) data(pheno_parameters) results <- run_complete_analysis(pheno_time_series, pheno_parameters) ## End(Not run)
A robust version of multidimensional plasticity analysis with error handling and data validation. This function calculates actual plasticity indices based on environmental variation in phenotypic traits.
safe_multidim_plasticity( data, traits, environments, groups, weights = NULL, na.action = "omit", ... )safe_multidim_plasticity( data, traits, environments, groups, weights = NULL, na.action = "omit", ... )
data |
A data frame containing phenotypic and environmental data |
traits |
Character vector of trait names to analyze |
environments |
Character vector of environmental variables |
groups |
Character string specifying the grouping variable (e.g., genotype, population) |
weights |
Optional numeric vector of weights for each trait (ecological importance) |
na.action |
How to handle missing values: "omit" (default), "fail", "impute.mean" |
... |
Additional arguments passed to the plasticity calculation |
A list containing:
individual_plasticity |
Data frame with plasticity indices for each group |
group_plasticity |
Summary statistics by group |
multidimensional_index |
Overall multidimensional plasticity index |
safe_analysis |
List with analysis metadata and success status |
message |
Informative message about the analysis |
# Create example data with real variability set.seed(123) example_data <- data.frame( genotype = rep(paste0("G", 1:10), each = 4), environment = rep(c("Cold", "Cool", "Warm", "Hot"), 10), trait1 = rnorm(40, mean = 10, sd = 2), trait2 = rnorm(40, mean = 5, sd = 1), trait3 = rnorm(40, mean = 20, sd = 3) ) # Run analysis result <- safe_multidim_plasticity( data = example_data, traits = c("trait1", "trait2", "trait3"), environments = "environment", groups = "genotype" ) print(result)# Create example data with real variability set.seed(123) example_data <- data.frame( genotype = rep(paste0("G", 1:10), each = 4), environment = rep(c("Cold", "Cool", "Warm", "Hot"), 10), trait1 = rnorm(40, mean = 10, sd = 2), trait2 = rnorm(40, mean = 5, sd = 1), trait3 = rnorm(40, mean = 20, sd = 3) ) # Run analysis result <- safe_multidim_plasticity( data = example_data, traits = c("trait1", "trait2", "trait3"), environments = "environment", groups = "genotype" ) print(result)
Generates realistic simulated data for plasticity studies with customizable parameters for traits, environments, and plasticity patterns. Useful for teaching and method validation.
simulate_plasticity_data( n_genotypes = 20, n_environments = 5, n_traits = 3, plasticity_patterns = list("gradient", "optimal", "neutral"), trait_correlations = 0.3 )simulate_plasticity_data( n_genotypes = 20, n_environments = 5, n_traits = 3, plasticity_patterns = list("gradient", "optimal", "neutral"), trait_correlations = 0.3 )
n_genotypes |
Number of genotypes/populations |
n_environments |
Number of environmental conditions |
n_traits |
Number of phenotypic traits |
plasticity_patterns |
List of plasticity patterns: "gradient", "threshold", "optimal" |
trait_correlations |
Correlation structure between traits |
Simulated plasticity dataset