# State dissimilarities
d <- vegan::vegdist(EDR_data$EDR3$abundance[, paste0("sp", 1:12)], method = "bray")
trajectories <- EDR_data$EDR3$abundance$traj
states <- EDR_data$EDR3$abundance$state
# Calculate the representative trajectories of an EDR to be used as reference
RT <- retra_edr(d,
trajectories = trajectories,
states = states,
minSegs = 10)
# Define the target states
target_states <- as.integer(c(1, 16, 55))
# Calculate the position of the target states with respect to the representative
# trajectories of an EDR
state_to_trajectory(d, trajectories = trajectories,
states = states,
target_states = target_states,
reference = RT,
method = "nearest_state")
Run the code above in your browser using DataLab