Per the title, does anyone know why rendering a ggpairs
plot from the GGally
package takes significantly longer in RStudio vs. base R (or terminal)?
Example:
start.time <- Sys.time()
ggpairs(mtcars)
end.time <- Sys.time()
time.taken <- end.time - start.time
time.taken
Running this in RStudio on my machine takes on the order of 5 times longer than base R. I have experienced the same slow down regardless of OS (Windows vs. Mac).
Are there any workarounds?
Other packages?
Specifically, how to render something like:
GGally::ggpairs(iris, color = "Species")
quickly without leaving RStudio?
The basic application of ggpairs is similar to the pairs function of base R. You simply have to write the following R code: Figure 5: ggpairs R Plot via ggplot2 & GGally packages.
The ggpairs function The GGally provides a function named ggpairs which is the ggplot2 equivalent of the pairs function of base R. You can pass a data frame containing both continuous and categorical variables.
The GGally R package is an extension of the ggplot2 package and adds several additional functions for the plotting of data in R. Here you can find the CRAN page of the GGally package. You can find tutorials and examples for the GGally package below. In the following, you can find a list of other useful R packages.
Anyone who works in the data science space is familiar with R. You’ve surely come across someone making the argument that R is a slow language and can’t handle larger data. That simply isn’t always the case. A lot of R code I’ve seen in the wild shows that there is a lack of fundamental understanding of how the language works.
I had similar issues, and spent some time trying to figure out why. I found four significant issues (not an exhaustive list). If your situation is like mine, then 1 and 2 are your main concerns.
You can read more on my github here: https://github.com/zstachniak/Elapsed-Time-Pairwise-Functions/blob/master/ggpairs.md
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With