ggplot2 – Subsetting plots in R with pairs function

I have a simple question however I can’t find the answer. I have a dataset in R with 1000 rows and 5 columns as follows:

data <- matrix(rnorm(1000 * 5, mean = 0, sd = 1), 1000, 5)
colnames(data) <-
    c("A", "B", "C", "D", "E")

I want to visually examine the relation between A and all other columns. How can I do that in R? If I wanted all the combination, I would have used the pairs(data) function. the above simulation is a very simple example but when 20 columns exist, this subset reduces the complexity and it is a less consuming process. Is there any way to make calculate and present visually the plot of A with all others and also add the trend line?

Read more here: Source link