Closed ngotelli closed 10 years ago
I'd say that's because you're trying to use the null_model_engine
fxn, which I've tried to obscure from the user in the hopes of making it more user friendly. So this should run fine:
warbMod <- niche_null_model(macwarb)
summary(warbMod)
plot(warbMod,type="niche")
plot(warbMod, type="hist")
Your other issue is that I tried to use more standard R conventions for fxn names, so RA1
is actually ra1
. You can see from the fxn wrappers that I match the arguments and convert them to the actual names which I then pass to the main null_model_engine
niche_null_model <- function(species_data, algo = "ra3", metric = "Pianka", n.reps = 1000, row.names = TRUE, random.seed = 0){
a.choice <- c("ra1","ra2","ra3","ra4")
m.choice <- c("Pianka", "Czekanowski", "Pianka.var", "Czekanowski.var", "Pianka.skew", "Czekanowski.skew")
m.func <- c("pianka", "czekanowski", "pianka_var", "czekanowski_var", "pianka_skew", "czekanowski_skew")
algo <- match.arg(algo,choices = a.choice)
metric <- match.arg(metric,choices = m.choice)
#Now do the substitutions
metric <- m.func[which(m.choice==metric)]
Ted - I am very glad to see that you are using good R programming conventions! Nick and I can learn a lot from this.
Best, Aaron
From: Edmund Hart [mailto:notifications@github.com] Sent: Friday, August 01, 2014 12:57 PM To: GotelliLab/EcoSimR Subject: Re: [EcoSimR] null_model_engine not finding algo functions (#16)
I'd say that's because you're trying to use the null_model_engine fxn, which I've tried to obscure from the user in the hopes of making it more user friendly. So this should run fine:
warbMod <- niche_null_model(macwarb)
summary(warbMod)
plot(warbMod,type="niche")
plot(warbMod, type="hist")
Your other issue is that I tried to use more standard R conventions for fxn names, so RA1 is actually ra1. You can see from the fxn wrappers that I match the arguments and convert them to the actual names which I then pass to the main null_model_engine
niche_null_model <- function(species_data, algo = "ra3", metric = "Pianka", n.reps = 1000, row.names = TRUE, random.seed = 0){
a.choice <- c("ra1","ra2","ra3","ra4")
m.choice <- c("Pianka", "Czekanowski", "Pianka.var", "Czekanowski.var", "Pianka.skew", "Czekanowski.skew")
m.func <- c("pianka", "czekanowski", "pianka_var", "czekanowski_var", "pianka_skew", "czekanowski_skew")
algo <- match.arg(algo,choices = a.choice)
metric <- match.arg(metric,choices = m.choice)
metric <- m.func[which(m.choice==metric)]
— Reply to this email directly or view it on GitHubhttps://github.com/GotelliLab/EcoSimR/issues/16#issuecomment-50908445.
Many thanks Ted! I was working off the example code that is shown in the null_model_engine
help, which lists the choices as RA1
, RA2
, etc. I will clean that up as I start to work through all of the functions.
Aaron is right, we are going to learn a lot of good programming tools working with you on this.
The following code works for setting up and getting into dev mode:
However, at this point, the example code in the help documentation for
null_model_engine
is failing: