Error in as.double(y) : cannot coerce type 'S4' to vector of type 'double' but not sure how to fix it

Please see the FAQ. The data provided is insufficient to reproduce the result.