'Impossible to plot a S4 raster object

When I try to run plot() function in order to visualize a raster object it gives me the same error. I have read some about S4 class but I can't do nothing to solve it.

superf_coste <- create_slope_cs(dem = dem_lisboa, cost_function = 'tobler', neighbours = 16) %>%
  "*" (create_traversal_cs(dem = dem_lisboa, neighbours = 16))

raster::plot(superf_coste)
r


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source