Frog traits respond to increasing levels of urbanization, but some trait cluster (evidence of niche processes -maybe) and some trait diverge (evidence for competition – maybe).

I found that out by using the attached function that I modified from package SYNCSA. This is a great package once you understand the terminology, but you have to use a phylogenetic distance matrix to get it to run. I didn’t have one so i modified the code accordingly. I haven’t changed the output terminology so roTE= significant trait convergence, roXE= traits are either significantly diverging/converging, roXE.T= significant trait divergence. See Pillar&Duarte (2010) Ecology Letters paper for more calculation details.

Here is the code:

syncsa1<-

function (comm, traits, envir, method = “pearson”,

dist = “euclidean”, scale = TRUE, scale.envir = TRUE, permutations = 999,

na.rm = FALSE, notification = TRUE)

{

N <- permutations

roTE <- 0

roXE <- 0

roXE.T <- 0

note.roTE <- paste(“Trait-convergence assembly patterns (TCAP): roTE”)

note.roXE <- paste(“Both trait-convergence assembly patterns and trait-divergence assembly patterns: roXE”)

note.roXE.T <- paste(“Trait-divergence assembly patterns (TDAP): roXE.T”)

note <- rbind(note.roTE, note.roXE, note.roXE.T)

colnames(note) = “Correlation meanings”

if (notification == TRUE) {

if (!missing(comm) == “TRUE”) {

c.NA

0) {

warning(“Warning: NA in community data”, call. = FALSE)

}

}

if (!missing(traits) == “TRUE”) {

t.NA

0) {

warning(“Warning: NA in traits matrix”, call. = FALSE)

}

}

if (!missing(envir) == “TRUE”) {

e.NA

0) {

warning(“Warning: NA in environmental data”,

call. = FALSE)

}

}

}

if (!missing(traits) == “TRUE”) {

matrixT <- matrix.t(comm, traits, scale = scale, notification = FALSE)

matrixX <- matrix.x(comm, traits, scale = scale, notification = FALSE)

W <- matrixT$matrix.w

B <- matrixT$matrix.b

T <- matrixT$matrix.T

U <- matrixX$matrix.u

X <- matrixX$matrix.X

if (!missing(envir) == “TRUE”) {

E <- envir

if (scale.envir == “TRUE”) {

E <- cent.norm(envir, na.rm = na.rm)

}

{ roTE <- cor.matrix(W, B, T, E, method = method, dist = dist,

permutations = N, norm = scale, na.rm = na.rm)

roXE <- cor.matrix(W, U, X, E, method = method, dist = dist,

permutations = N, na.rm = na.rm)

roXE.T <- cor.matrix.partial(W, U, X, E, T, method = method,

dist = dist, permutations = N, na.rm = na.rm)

}

if (scale == “TRUE”) {

dist.traits <- vegdist(traits, method = “gower”,

diag = TRUE, upper = TRUE, na.rm = na.rm)

}

SYNCSA <- rbind(roTE, roXE, roXE.T)

return(list(Notes = note, Statistics = SYNCSA))

}}}