Skip to content

Instantly share code, notes, and snippets.

@chriscesar
Last active February 10, 2017 11:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chriscesar/4204bc6cb9be0240636c3f52eae07258 to your computer and use it in GitHub Desktop.
Save chriscesar/4204bc6cb9be0240636c3f52eae07258 to your computer and use it in GitHub Desktop.
### Issue of getting 'argument "undef.zero" is missing with no default' error when running simprof with bray curtis distance on species density data
### INFO: I'm running clustsig version 1.1 in R version 3.3.2
### Load package
require(clustsig)
### Import data
df <-
structure(
list(
Abratenu = c(
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
19.5943297127603,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
19.5943297127603
),
Austmode = c(
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
137.160307989322,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
),
Capitell = c(
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
58.7829891382809,
0,
78.3773188510412,
0,
0,
0,
19.5943297127603,
0,
0,
0,
0,
58.7829891382808
),
Cerstdrm = c(
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
19.5943297127603
),
Ceraedul = c(
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
19.5943297127603,
901.339166786972,
0,
58.7829891382808,
0,
0,
0,
0,
0,
7994.4865228062,
0,
0,
0,
0,
5231.68603330699
),
Copepoda = c(
0,
0,
19.5943297127603,
0,
0,
0,
19.5943297127603,
0,
0,
19.5943297127603,
0,
0,
0,
0,
0,
0,
0,
607.424221095569,
0,
0,
19.5943297127603,
0,
0,
0,
0,
0,
0
),
Cumogood = c(
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
19.5943297127603,
0,
0,
0,
0,
0,
39.1886594255206,
0,
0,
0,
0,
0,
0,
0,
0,
0
),
Eteolong = c(
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
19.5943297127603,
0,
0,
0,
0,
0,
19.5943297127603,
58.7829891382809
),
Hausaren = c(
0,
0,
19.5943297127603,
0,
0,
0,
0,
0,
0,
19.5943297127603,
0,
0,
0,
0,
78.3773188510412,
0,
39.1886594255206,
0,
0,
0,
0,
0,
0,
0,
0,
19.5943297127603,
0
),
Laniconc = c(
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
195.943297127603,
0,
0,
0,
0,
156.754637702082
),
Limebalt = c(
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
97.9716485638014,
0,
0,
0,
0,
293.914945691404
),
Littlitt = c(
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
19.5943297127603,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
),
Melipalm = c(
0,
0,
19.5943297127603,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
),
Mcrphthl = c(
0,
0,
0,
0,
0,
0,
0,
0,
0,
39.1886594255206,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
),
Nematoda = c(
97.9716485638015,
999.310815350775,
19.5943297127603,
39.1886594255206,
0,
78.3773188510411,
1097.28246391458,
97.9716485638014,
39.1886594255206,
313.509275404164,
156.754637702082,
19.5943297127603,
0,
0,
19.5943297127603,
0,
0,
3879.67728312653,
0,
39.1886594255206,
97.9716485638014,
0,
78.3773188510412,
235.131956553124,
372.292264542445,
0,
0
),
Nemertea = c(
0,
0,
0,
0,
39.1886594255206,
0,
0,
0,
0,
0,
0,
19.5943297127603,
0,
0,
0,
39.1886594255206,
0,
0,
0,
0,
0,
0,
0,
0,
0,
19.5943297127603,
0
),
Parafult = c(
0,
19.5943297127603,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
),
Parafulg = c(
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
19.5943297127603,
0,
19.5943297127603,
0,
0,
0,
0,
0,
0,
0,
0,
0
),
Periulva = c(
0,
0,
19.5943297127603,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
2664.8288409354,
0,
431.075253680726,
0,
0,
391.886594255207,
39.1886594255206,
19.5943297127603,
0,
0,
58.7829891382809,
0,
19.5943297127603,
0
),
Petrphol = c(
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
19.5943297127603,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
),
Phylmuco = c(
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
39.1886594255206,
0,
0,
0,
0,
0
),
Protchae = c(
313.509275404165,
0,
0,
0,
0,
0,
0,
0,
0,
39.1886594255206,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
39.1886594255206,
0,
0,
0,
0
),
Pygoeleg = c(
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
97.9716485638015,
0,
0,
0,
0,
470.263913106248
),
Scolsqua = c(
0,
0,
0,
39.1886594255206,
0,
0,
0,
0,
0,
39.1886594255206,
0,
0,
0,
0,
117.565978276562,
39.1886594255206,
19.5943297127603,
0,
176.348967414843,
274.320615978644,
0,
0,
19.5943297127603,
0,
78.3773188510412,
764.178858797652,
0
),
Scolarmi = c(
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
313.509275404165,
0,
0,
0,
0,
333.103605116925
),
Tharyx = c(
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
19.5943297127603
),
Tubipseu = c(
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
176.348967414842
),
Turbellr = c(
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
39.1886594255206,
0,
0,
0,
0
),
Urotpose = c(
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
19.5943297127603
),
Nephtys = c(
0,
0,
78.3773188510412,
19.5943297127603,
0,
0,
0,
0,
0,
0,
0,
39.1886594255206,
176.348967414843,
0,
0,
0,
0,
58.7829891382808,
0,
0,
117.565978276562,
137.160307989322,
19.5943297127603,
0,
0,
0,
19.5943297127603
),
Pontcrts = c(
0,
0,
0,
0,
0,
0,
0,
0,
0,
19.5943297127603,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
),
Bathypor = c(
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
39.1886594255206,
39.1886594255206,
19.5943297127603,
0,
0,
0,
0,
0,
0,
0,
0,
19.5943297127603,
0
),
Corophim = c(
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
39.1886594255206,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
58.7829891382808
),
Eurydice = c(
19.5943297127603,
0,
0,
19.5943297127603,
19.5943297127603,
0,
0,
0,
0,
39.1886594255206,
19.5943297127603,
0,
0,
0,
39.1886594255206,
19.5943297127603,
333.103605116925,
0,
0,
0,
0,
0,
19.5943297127603,
0,
0,
235.131956553123,
0
)
),
.Names = c(
"Abratenu",
"Austmode",
"Capitell",
"Cerstdrm",
"Ceraedul",
"Copepoda",
"Cumogood",
"Eteolong",
"Hausaren",
"Laniconc",
"Limebalt",
"Littlitt",
"Melipalm",
"Mcrphthl",
"Nematoda",
"Nemertea",
"Parafult",
"Parafulg",
"Periulva",
"Petrphol",
"Phylmuco",
"Protchae",
"Pygoeleg",
"Scolsqua",
"Scolarmi",
"Tharyx",
"Tubipseu",
"Turbellr",
"Urotpose",
"Nephtys",
"Pontcrts",
"Bathypor",
"Corophim",
"Eurydice"
),
class = "data.frame",
row.names = c(NA,
27L)
)
########################################
## RUN SIMPROF
set.seed(4656) ## no idea if this is even required!
sim <- simprof(df, method.transform = "squareroot",
method.distance = "braycurtis")### ERROR APPEARS HERE & remains even if I define undef.zero=TRUE OR FALSE
### Oddly, I didn't get an error when I accidentally left a numeric variable of the number of replicates taken:
### Including
# df$rep <- 3 ### in the data frame gives me 6 significant clusters.
###Not sure why? Is my data too sparse for braycurtis to play nice with?
### Hoping to produce a dendrogram coloured by cluster
cbPalette <- c(
"#0072B2",
"#e79f00",
"#009E73",
"#9ad0f3",
"#000000",
"#D55E00",
"#CC79A7",
"#F0E442"
)
pl.color <- simprof.plot(sim, leafcolors = cbPalette)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment