[R-sig-eco] correlation plot in color

Manuel Esteban Lucas Borja M@nue|E@teb@n@Luc@@ @end|ng |rom uc|m@e@
Sun Mar 22 14:29:06 CET 2020


Dear Drew,
Thank you very much for your help. The thing is that when I import the dataset containing categorical and numeric variables and then I want to calculate the correlation graphic, Rstudio says that it is not posible as categorical variables can not be used for correlation. So, which is the code for calculating correlation plots including a categorical variable, which will be them used for adding colours depending of the levels of this categorical factor?
Thanks a lot for your advise, I really apreciate your help.
Best
Manuel




Manuel Esteban Lucas Borja
Profesor Contratado Doctor Interino / Assistant Professor
Coordinador de Relaciones Internacionales del Campus de Albacete/Coordinator for International Relations on Albacete Campus

Universidad de Castilla-La Mancha
E.T.S. Ingenieros Agrónomos y de Montes / Higher Technical School of Agricultural and Forestry Engineering | Campus Universitario s/n | C.P. 02071 Albacete
Tfno: 967 599 200 | Ext: 2818 |


________________________________
From: Drew Tyre <atyre2 using unl.edu>
Sent: Sunday, March 22, 2020 2:12:31 PM
To: Manuel Esteban Lucas Borja <ManuelEsteban.Lucas using uclm.es>; r-sig-ecology using r-project.org <r-sig-ecology using r-project.org>
Subject: Re: [R-sig-eco] correlation plot in color

Manuel,

T may be getting interpreted as TRUE, not your variable name. Try renaming the variable to something else and see if that helps.

--
Drew Tyre

He/him/his

While I may be sending this email outside my normal office hours,
I have no expectation to receive a reply outside of yours.

School of Natural Resources
University of Nebraska-Lincoln
416 Hardin Hall, East Campus
3310 Holdrege Street
Lincoln, NE 68583-0974

phone: +1 402 472 4054
fax: +1 402 472 2946
email: atyre2 using unl.edu
http://snr.unl.edu/tyre
http://drewtyre.rbind.io

“Anything worth doing is worth doing badly.”

* G. K. Chesterton

On 3/21/20, 8:32 PM, "R-sig-ecology on behalf of Manuel Esteban Lucas Borja" <r-sig-ecology-bounces using r-project.org on behalf of ManuelEsteban.Lucas using uclm.es> wrote:

    Dear all,



    First of all, I hope this email will find you well.



    I am working with a biological dataset (please see in attachment) composed by 5 variables. The columns EMF, Biodiversity, MDS1 and MDS2 are numerical variables whereas T is a categorical one.



    I would like to obtain a correlation chart showing correlation coefficients, histograms and different colours for each observation following the categorical variable "T". Please see below the initial chart I got but in which observations are not classified in different colours following the categorical variable "T".



    This is the code I used with any positive result back.



    corrMatOrder (dataset, histogram = T, pch = 19, method= spearman, family="CM Roman", col=c("red", "green3", "blue", "black")[code.levels(dataset$T)])



    I work with Rstudio. Thank you very much for your time and help.

    Best



    Manuel


    _______________________________________________
    R-sig-ecology mailing list
    R-sig-ecology using r-project.org
    https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_r-2Dsig-2Decology&d=DwIFAg&c=Cu5g146wZdoqVuKpTNsYHeFX_rg6kWhlkLF8Eft-wwo&r=aLEaSryyUcERVqcKVZl7lQ&m=8ZU0mK0lLpXPq2WJfDahUzu7C12RW7imeOWQ_rvGsiA&s=PaGMWGrC4sn6FfrSXEvZnzrBSounwJEENXLeoXL4Cjc&e=



	[[alternative HTML version deleted]]



More information about the R-sig-ecology mailing list