Based on the code below how can I fix this error:
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
namespace ‘terra’ 1.6-7 is being loaded, but >= 1.6.16 is required
In addition: Warning message:
`stat(nlevel)` was deprecated in ggplot2 3.4.0.
ℹ Please use `after_stat(nlevel)` instead.
Code:
library(rayshader) # latest version 0.24.10
# 3D plotting with rayshader and ggplot2
ggdiamonds = ggplot(diamonds)
stat_density_2d(aes(x = x, y = depth, fill = stat(nlevel)),
geom = "polygon", n = 200, bins = 50,contour = TRUE) facet_wrap(clarity~.)
scale_fill_viridis_c(option = "A")
par(mfrow = c(1, 2))
plot_gg(ggdiamonds, width = 5, height = 5, raytrace = FALSE, preview = TRUE)
CodePudding user response:
Looks like your version of terra needs updating:
install.packages("terra")