Your college[,1:10]
dataset contain columns that are not numeric.
Run:
str(college[,1:10])
And inspect the column types in your dataframe.
Since pairs matrix essentially creates a matrix of scatterplot using each combination of columns, it expect a dataframe with numeric columns only.
This makes sense, if you consider the fact that you wouldn't create a scatterplot using Student Gender (a categorical variable, i.e non-numeric) against Student Age for example. It doesn't make sense.
In your case, this error:
Error in pairs.default(college[, 1:10]) : non-numeric argument to 'pairs'
Tells you that among the 10 columns, one or more of these are non-numeric. Either remove these columns in your call to pairs()
or perform explicit coercion using as.numeric()
.