-2

I would like to resolve the error I am getting while running the code below.

I have tried to debug the code but I am still getting the same error message.

glmer_results= evaluatr.univariate(analysis)
lapply(glmer_results,evaluatr.univariate.plot)

Error in variance.vars[[i]] : subscript out of bounds Calls: ... eval -> eval -> evaluatr.univariate -> evaluatr.impact.pre

Execution halted

Maurits Evers
  • 49,617
  • 4
  • 47
  • 68
  • 1
    Please take some time reviewing [how to ask](https://stackoverflow.com/help/how-to-ask) questions, and what you can (and should) do in order to provide a [minimal reproducible example/attempt](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). Then [edit](https://stackoverflow.com/posts/58743354/edit) your question accordingly. In a nutshell, we should be able to copy&paste the code you give to reproduce the error you're seeing. If you can't share the original data (due to size, confidentiality etc.), you should provide representative & minimal mock data. – Maurits Evers Nov 07 '19 at 07:16
  • 1
    [continued] Also always explicitly state which external R libraries you've been using. For example, where is `evaluatr.univariate` from? – Maurits Evers Nov 07 '19 at 07:20
  • I can give the code and the data but is too long for this box ``` – ALLAN AUDI Nov 07 '19 at 08:55
  • Don't post code/data in comments, as they might get deleted and don't allow for proper code formatting. Instead, edit your post. – Maurits Evers Nov 07 '19 at 09:10

1 Answers1

0

It is very hard to provide an answer without a reproducible example. However, the subscript out of bounds error message means that you are trying to subset an element, in this case variance.vars appears to be a list, but the element you are trying to fetch doesn't exist.

For example, if variance.vars is of length 2, but your index i goes up to three, then variance.vars[[1]] and variance.vars[[2]] will work and return the corresponding list element, but variance.vars[[3]] will fail and give the error message subscript out of bounds since the third list element doesn't exist. This is true if you try to extract elements from vectors or matrices as well.

edsandorf
  • 757
  • 7
  • 17