Problems with ggpairs() from GGally package

Hi there,

I have problems with the ggpairs() function throwing an error even after checking for NA and odd data column names:
library(ggplot2)
library(GGally)
ggpairs(data = dat_pair)

Error in geom_text():
! Problem while computing aesthetics.
:information_source: Error occurred in the 1st layer.
Caused by error:
! object 'X' not found

Backtrace:

  1. ├─base (local) <fn>(x)
  2. ├─GGally:::print.ggmatrix(x)
  3. │ └─GGally::ggmatrix_gtable(x, ...)
  4. │ └─GGally:::plot_gtable(p)
  5. │ ├─ggplot2::ggplot_gtable(ggplot_build(p))
  6. │ │ └─ggplot2:::attach_plot_env(data$plot$plot_env)
  7. │ │ └─base::options(ggplot2_plot_env = env)
  8. │ ├─ggplot2::ggplot_build(p)
  9. │ └─ggplot2:::ggplot_build.ggplot(p)
  10. │ └─ggplot2:::by_layer(...)
  11. │ ├─rlang::try_fetch(...)
  12. │ │ ├─base::tryCatch(...)
  13. │ │ │ └─base (local) tryCatchList(expr, classes, parentenv, handlers)
  14. │ │ │ └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
  15. │ │ │ └─base (local) doTryCatch(return(expr), name, parentenv, handler)
  16. │ │ └─base::withCallingHandlers(...)
  17. │ └─ggplot2 (local) f(l = layers[[i]], d = data[[i]])
  18. │ └─l$compute_aesthetics(d, plot)
  19. │ └─ggplot2 (local) compute_aesthetics(..., self = self)
  20. │ └─base::lapply(aesthetics, eval_tidy, data = data, env = env)
  21. │ └─rlang (local) FUN(X[[i]], ...)
  22. └─base::.handleSimpleError(<fn>, "object 'X' not found", base::quote(NULL))
  23. └─rlang (local) h(simpleError(msg, call))
  24. └─handlers[[1L]](cnd)
    
  25.   └─cli::cli_abort(...)
    
  26.     └─rlang::abort(...)
    

dat_pair:

elevation heatload prec8110
1.1051899 0.359055429 0.387516232
0.956123151 0.292817942 0.387516232
-0.053935174 0.011003425 -1.27063566
0.089991802 -1.035927267 -0.222119661
0.123403071 0.171910421 -0.055813353
0.619436259 -0.059858997 -0.031484173
-0.719596556 0.238772245 -1.517715403
0.118262514 1.667634597 -0.182204814
0.503780779 -0.474286454 -1.063257033
0.064290584 0.265676869 -1.063257033
0.064290584 0.265676869 -1.063257033
1.218274318 -0.053980274 -0.002525092
-2.079191599 -0.838244689 -1.41945956
-0.549969146 1.802826185 -0.253426075
0.956123151 -0.58640957 -0.031484173

What could be causing the problem?

Somehow processing the data (scaling and subsetting by data_pair[,1:15]) caused the error, saving the data frame as .csv with write.csv and reading in again solved the issue. Maybe someone has an explanation for this? Are there attributes stored within the data frame which confuses geom_text?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.