Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>From <code>?glmulti</code>, </p> <blockquote> <p>If [the argument <code>data</code> is] not specified, glmulti will try to find the data in the environment of the formula, from the fitted model passed as y argument, or from the global environment.</p> </blockquote> <p>However, when you specify <code>data = temp1</code>, <code>glmulti</code> apparently looks in the global environment for this object. Therefore, you may need to assign your randomly selected data to the global environment (I've renamed things a little to try and keep names and objects in check):</p> <pre><code>glm.random2&lt;-function(df){ reps=5 output&lt;-matrix(NA, ncol=1, nrow=0) while (length(output[,1])&lt;reps) { ## Here things are different temp2 &lt;- ddply(df,.(study_id),randomRows,1) names(temp2)[2]&lt;-"cOntinent" assign("temp1",temp2,envir=.GlobalEnv) ## Note the slightly modified formula, to check whether ## gmulti looks for terms in temp1 or simply as named objects in the environment ## It looks like the former, which is good. temp3 &lt;- glmulti(yi_pos ~ cOntinent+taxatype+metric, data = temp1, family = gaussian( link = log), crit = aic, plotty = F, report = F) temp4 &lt;- noquote(paste(summary(temp3)$bestmodel[1])) output&lt;-rbind(output,temp4) ## Remove the object temp1 from the global environment rm(temp1,envir=.GlobalEnv) } write.table(output, "output.glm.random1.txt", append=TRUE, sep="\t", quote=FALSE) } # run function - no error for me! glm.random2(df) </code></pre> <p>You might want to check with the package maintainer to see if this is the intended way for <code>glmulti</code> to work.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload