'Extract the last row of a pairs plot in R
I have created this pairs plot of a 10X10 data frame. I am interested in extracting only the last row, as it shows the covariates (on x axis) against the response parameter of interest (on y axis) for each covariate. I have used basic R pairs plot, but if a solution exist for ggpairs I can easily modify the code below.
pairs.panels(data, smooth = TRUE, scale = FALSE, density = TRUE, ellipses = FALSE)
The pairs plot looks like this:

Solution 1:[1]
I wrote a package called psre (you can install it from CRAN) and it has a function called lsa() (which stands for Linear Scatterplot Array). The function does what you want. Here's how it works:
library(psre)
data(wvs)
lsa(sacsecval ~ resemaval + moral +
pct_univ_degree + pct_female +
pct_low_income,
xlabels = c("Emancipative Vals", "Moral Perm",
"% Univ Degree", "% Female", "% Low Income"),
ylab = "Secular Values",
data=wvs)
Solution 2:[2]
Use the arg horInd, which is documented in ?graphics::pairs.
library(psych)
pairs.panels(attitude, horInd = 7)
The original output:
pairs.panels(attitude)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | DaveArmstrong |
| Solution 2 | Darren Tsai |



