0
I’m learning to work with the R yet. I’m trying to build a dendrogram from correlation tests, between isotopic and meteorological data. I did the following:
RC <- read.csv("RCmatrix.csv")
head(RC)
dim(RC)
summary (RC)
cormat <- round(cor(RC),2)
Quando chego aqui aparece: Error in cor(RC) : 'x' deve ser numérico
head(cormat)
dim(cormat)
library(heatmaply)
heatmaply(cor(RC), margins = c(40,130),
k_col = 2, k_row = 2, colors = Spectral, seriate = "OLO",
limits = c(-1,1))
My data matrix has 288 rows and 18 columns.
Look, with a piece of code makes it easier to help, you can use
dput(head(RC))
. I recommend trying on the consoleclass(RC)
ortypeof(RC)
to see if it is in numerical format.– Jorge Mendes
The
summary
should give a clue. What kind of data are all numerical? Also trystr(RC)
and run thecor
only for numerical columns, class"numeric"
or"integer"
.– Rui Barradas
i_col <- sapply(RC, class) %in% c("integer", "numeric");cor(RC[which(i_col)])
– Rui Barradas