Skip to content
Prev 6090 / 7420 Next

correlation plot in color

Hola Manuel:


As you have loaded the ggplot2 package, one simple way to do the correlation plots (one at the time though) is, for example for your pair of variables EMF and your first MSD axis:

ggplot(data = Libro) + geom_point(mapping = aes(x = EMF, y = MSD1, color = Treat))I hope this helps.?


Salvador
An independent consultant
Biostatistics, GIS, RS


En Dom, 22 Marzo, 2020 en 10:34, Manuel Esteban Lucas Borja <ManuelEsteban.Lucas at uclm.es> escribi?:
?

Para: Bede-Fazekas ?kos; r-sig-ecology at r-project.org
Dear ?kos Bede-Fazekas
Sorry for the missed information. Please see the packages I used: 

library(readxl)
library(dplyr)
library(ggplot2)
library(GGally)
library(Hmisc)
library(corrplot)
library(PerformanceAnalytics)

Then I import the attached dataset (Libro1) containing 5 variables: EMF, bio, MSD1, MSD2 (all of them numerical) and Treat (categorical).
Then I wrote:

            
And got the error: 

Error in pairs.default(x, gap = 0, lower.panel = panel.smooth, upper.panel = panel.cor) : 
non-numeric argument to 'pairs' 

And I would like to obtain the plot you can see on the doc file, where correlation points are divided by a category (red, gren and blue)

Thanks a lot for your help
Manuel 



-----Mensaje original-----
De: R-sig-ecology <r-sig-ecology-bounces at r-project.org> En nombre de Bede-Fazekas ?kos
Enviado el: domingo, 22 de marzo de 2020 16:57
Para: r-sig-ecology at r-project.org
Asunto: Re: [R-sig-eco] correlation plot in color

Dear Manuel,

since neither a reproducible example or your dataset are provided, nor the details of your problem (results of sessionInfo(); the package of corrMatOrder(); the error message you got) are known by us, it is a bit hard to help you. Anyway, I guess, that your data is not in categorical
(factor) but in ordinal (ordered) scale. If you convert your ordoered data to numeric with as.numeric(), then Spearman and Kendall rank correlations can be used.

HTH,
?kos Bede-Fazekas
Hungarian Academy of Sciences


2020.03.22. 14:29 keltez?ssel, Manuel Esteban Lucas Borja ?rta:
_______________________________________________
R-sig-ecology mailing list
R-sig-ecology at r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
_______________________________________________
R-sig-ecology mailing list
R-sig-ecology at r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology