Solution :
I was having the similar configuration as you are having now and I had also faced this kind of issue in the past.
If you just try to update the ggplot2 library as shown below
devtools::install_github('cran/ggplot2')
Then it will solve your problem.
While I was working with mongodb, ggplot and Rshiny I was facing the same error and As the workaround I just converted all NULL value in my dataframe as NA
#For the mongodb aggregation try below approach
out <- dbAggregate(con, "Documenti", list)
#For the conversion from JSON to nested lists try below approach
out2 <- lapply(out, fromJSON, simplifyDataFrame = TRUE)
# For the conversion to dataframe try below approach
dd <- do.call(rbind,out2)
# For the Conversion null value to NA try below approach
dd[sapply(dd, is.null)] <- NA
I hope the above solution will help you in resolving your error and it will help you in achieving your goal.