Error in $: object of type 'closure' is not subsettable

are you sure that's the line causing this error?

I ask because usually the error object of type 'closure' is not subsettable is saying you are trying to apply a subset to a function object,

for example;

f1 <- function() {
  return(NULL)
}
f1[1, 1]
#> Error in f1[1, 1]: object of type 'closure' is not subsettable

Could you produce a more full reprex of the issue? (REPRoducible EXample (reprex) A reprex makes it much easier for others to understand your issue and figure out how to help.)