afrilearndata
afrilearndata copied to clipboard
afrilandcover object can not be plotted
Dear afrilearndata team,
The afrilandcover
object can not be plotted using the raster::plot()
function.
pacman::p_load_gh("afrimapr/afrilearndata")
pacman::p_load(raster)
# the issue is here:
raster::plot(afrilandcover)
#> Error in .local(.Object, ...):
# as a comparison, this works:
raster::plot(afripop2020)
#
Created on 2022-04-07 by the reprex package (v2.0.1)
when I try to plot it using the ggplot2
and stars
packages I obtain the following output:
pacman::p_load(ggplot2)
pacman::p_load_gh("afrimapr/afrilearndata")
pacman::p_load(stars)
ggplot() +
geom_stars(data = st_as_stars(afrilandcover))
#> Loading required package: raster
#> Warning: package 'raster' was built under R version 4.1.3
#> Loading required package: sp
#> trying to read file: C:\Dropbox\_afrimapr\data\landcover-modis\MCD12C1.A2019001.Majority_Land_Cover_Type_1.tif
#> Error in .local(.Object, ...):
Created on 2022-04-07 by the reprex package (v2.0.1)
I hope this reprex be useful to identify a possible issue.