0

When trying to create a scatter matrix in R, I am using the pairs function inputting columns 1, 6, 11, and 14 as so:

pairs(~ 1 + 6 + 11 + 14, data = housing.df)

but getting an invalid model formula error:

pairs(~ 1 + 6 + 11 + 14, data = housing.df) Error in terms.formula(formula, data = data) : invalid model formula in ExtractVars

What does it mean, and how can it be resolved?

Yash
  • 11
  • 3
  • You can't specify column indices in a formula like that. You need to use column names. It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input that can be used to test and verify possible solutions. – MrFlick Jan 23 '21 at 20:05
  • data: https://archive.ics.uci.edu/ml/machine-learning-databases/housing/ imported in R using: housing.df <- read.csv("",header = FALSE) R version 4.0.3 on Windows – Yash Jan 23 '21 at 20:18
  • That was it, it worked when I inputted the column values – Yash Jan 23 '21 at 20:57

1 Answers1

0

pairs(~ V1 + V6 + V11 + V14, data = housing.df)

Yash
  • 11
  • 3