error: cannot coerce type ‘S4’ to vector of type ‘double’ when import graphics::plot

When I check one of my package, I got error:

Error in as.double(y) :
cannot coerce type ‘S4’ to vector of type ‘double’

If I remove the importFrom(graphics, plot) from the NAMESPACE, the error will not show.

The reason is that I did not import S4 method for plot.

The solution:

1. add stats4 as import package in DESCRIPTION

2. add importMethodsFrom(stats4, plot) in NAMESPACE.

Leave a Reply

  

  

  

%d 博主赞过: