Error: subscript out of bounds

Hi,

Welcome to the RStudio community!

I suggest you make a reprex of the issue, as just posting the error and part of the code is not helping us much here. A reprex consists of the minimal code and data needed to recreate the issue/question you're having. You can find instructions how to build and share one here:

In general, the "out of bounds error" happens when you try to access an index in a list that does not exists (e.g. index is larger than length of list). Look carefully in your code where this might happen, and you should be able to fix it.

myList = list(a = 1, b = 2, c = 3)

#Index 1 exists
myList[[1]]
#> [1] 1

#Index 4 does not exist
myList[[4]]
#> Error in myList[[4]]: subscript out of bounds

Created on 2021-09-21 by the reprex package (v2.0.0)

Hope this helps, otherwise post your reprex and we'll take it from there.

PJ