Trying to create ggplot2 boxplot of a raster using the rgrass interface. Just using the R boxplot() function works fine:
boxplot(sac_storages_df,names=c(“LZFPM”,“LZFSM”,“LZTWM”,“UZFWM”,“UZTWM”,“ZPERC”))
names(sac_storages_df)
[1] “sac_LZFPM” “sac_LZFSM” “sac_LZTWM” “sac_UZFWM_teaiii”
[5] “sac_UZTWM” “sac_ZPERC”
, but with ggplot, I keep getting:
ggplot(sac_storages_df,aes(x=names(sac_storages_df))) + geom_boxplot()
Error in geom_boxplot()
:
! Problem while computing aesthetics.
Error occurred in the 1st layer.
Caused by error in check_aesthetics()
:
! Aesthetics must be either length 1 or the same as the data (807282).
Fix the following mappings:
x
.
I have tried many differnt things to address the issue. Any ideas? I have to coerce the raster data read in from grass from a sparaster into a dataframe
Thank you