On Sun, 24 Sep 2023 18:05:43 +0000
"Parkhurst, David" <parkh...@indiana.edu> wrote:

> I have a matrix, KD6, and I_m trying to get a correlation matrix from
> it.  When I enter cor(KD6), I get the message _Error in cor(KD6) :
> 'x' must be numeric_.
> Here are some early lines from KD6:
>        Flow   E..coli        TN    SRP     TP    TSS
> 1      38.8    2,420    1.65300 0.0270 0.0630  66.80
> 2     133.0    2,420    1.39400 0.0670 0.1360   6.80

Use str(KD6) to find out the types of every column of the KD6 data
frame. There may be some non-numeric strings later in the document
preventing R from converting them to numeric automatically. A brute
force solution is as.numeric(), perhaps preceded by some string
manipulation, but it's better to find out why the strings were
considered non-numeric in the first place.

-- 
Best regards,
Ivan

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to