Re: [R-sig-eco] correlation plot in color
Amazing! Problem solved. Thanks again for your priceless help All the best, Manuel -Mensaje original- De: R-sig-ecology mailto:r-sig-ecology-boun...@r-project.org>> En nombre de Bede-Fazekas Ákos Enviado el: lunes, 23 de marzo de 2020 18:46 Para: r-sig-ecology@r-project.org<mailto:r-sig-ecology@r-project.org> Asunto: Re: [R-sig-eco] correlation plot in color Dear Manuel, and what happens if you use pairs() instead of chart.Correlation()? Is it colored? If yes, then it is a possible bug in function chart.Correlation(). Best, Ákos 2020.03.23. 17:20 keltezéssel, Manuel Esteban Lucas Borja írta: > Thanks Ákos, > > I did as you mentioned: > >> is.factor(libro1$Treat) > [1] FALSE > >> libro1$Treat <- as.factor(libro1$Treat) palette <- setNames(object = >> c(“red”, “green3”, “black”, “blue”), nm = levels (Libro1$Treat)) >> chart.Correlation(libro1[,1:4], histogram = T, pch = 19, bg = >> palette[Libro1$Treat]) > But nothing happens. I got again the correlation plot but doc values > are not in colour following the Treat classification > > Thanks for your time. > Best > Manuel > > > > > -Mensaje original- > De: R-sig-ecology > mailto:r-sig-ecology-boun...@r-project.org>> > En nombre de > Bede-Fazekas Ákos Enviado el: lunes, 23 de marzo de 2020 14:54 > Para: r-sig-ecology@r-project.org<mailto:r-sig-ecology@r-project.org> > Asunto: Re: [R-sig-eco] correlation plot in color > > Dear Manuel, > > are you sure that Libro1$Treat is really a categorical column (instead of > character)? > The example code that you sent us works for categorical data: > is.factor(get(data(iris))$Species) > TRUE > If is.factor(Libro1$Treat) is FALSE, then you should convert it from > character to factor, before creating the color palette and calling > chart.Correlation(): > Libro1$Treat <- as.factor(Libro1$Treat) > > Have a nice week, > Ákos > > 2020.03.23. 11:19 keltezéssel, Manuel Esteban Lucas Borja írta: >> Thanks Mollie, >> >> I have retyped all commands but nothing happens at the end. No error backs >> and no colour in correlations plots. >> >> >>> palette<-setNames(object = c("red", "green3", "black", "blue"), >>> nm=levels(Libro1$Treat)) chart.Correlation(Libro1[,1:4], >>> histogram=F, pch=21, bg=palette[Libro1$Treat]) >> Best >> Manuel >> >> >> >> >> -Mensaje original----- >> De: Mollie Brooks mailto:mollieebro...@gmail.com>> >> Enviado el: lunes, 23 de >> marzo de 2020 11:04 >> Para: Manuel Esteban Lucas Borja >> mailto:manuelesteban.lu...@uclm.es>> >> CC: Bede-Fazekas Ákos mailto:bfalevl...@gmail.com>>; >> r-sig-ecology@r-project.org<mailto:r-sig-ecology@r-project.org> >> Asunto: Re: [R-sig-eco] correlation plot in color >> >> It looks like the quotes are the fancy type (I can’t remember the official >> word for that). Try deleting and retyping all the quotes in that command. >> >> cheers, >> Mollie >> >>> On 23Mar 2020, at 10:52, Manuel Esteban Lucas Borja >>> mailto:manuelesteban.lu...@uclm.es>> wrote: >>> >>> Thanks Bede-Fazekas Ákos, >>> Thanks a lot for your help. >>> >>> I have installed also the library (colorspace) I got the following >>> error: >>> >>>> palette <- setNames(object = c(“red”, “green3”, “black”, “blue”), >>>> nm >>>> =levels(u$Treat)) >>> Error: unexpected input in "palette <- setNames(object = c(“" >>> >>> What can I do? >>> Best >>> Manuel >>> >>> >>> -Mensaje original- >>> De: R-sig-ecology >>> mailto:r-sig-ecology-boun...@r-project.org>> >>> En nombre de >>> Bede-Fazekas Ákos Enviado el: lunes, 23 de marzo de 2020 6:52 >>> Para: r-sig-ecology@r-project.org<mailto:r-sig-ecology@r-project.org> >>> Asunto: Re: [R-sig-eco] correlation plot in color >>> >>> Dear Manuel, >>> >>> please try this: >>> palette <- setNames(object = c(“red”, “green3”, “black”, “blue”), nm >>> = >>> levels(Libro$Treat)) >>> chart.Correlation(Libro[,1:4], histogram = T, pch = 19, bg= >>> palette[Libro$Treat]) >>> >>> Have a nice week, >>> Ákos >>> >>> 2020.03.23. 2:40 keltezéssel, Salvador SANCHEZ COLON írta: >>>> Hi Manuel, >>>> >>>> >>>> I am glad that you managed to plot the correlation plots. Then, as
Re: [R-sig-eco] correlation plot in color
Dear Manuel, the warning is saying that pairs() should be called without the histogram parameter. But the problem of black point symbols is caused by another thing: you chose a pch that has only color (col) but has no background/filling color (bg). Let's choose a pch value from the 21:25 interval and both pairs() and chart.Correlation() will plot symbols filled with colors! Best, Ákos 2020.03.23. 19:09 keltezéssel, Manuel Esteban Lucas Borja írta: Dear Ákos, Thanks for your priceless time and help. Still not working. palette <- setNames(object = c("red", "green3", "black", "blue"), nm=levels(libro1$Treat)) Warning messages: 1: In doTryCatch(return(expr), name, parentenv, handler) : "histogram" is not a graphical parameter 2: In doTryCatch(return(expr), name, parentenv, handler) : "histogram" is not a graphical parameter pairs(libro1[,1:4], histogram = F, pch = 19, bg = palette[libro1$Treat]) There were 50 or more warnings (use warnings() to see the first 50) And no colours on the correlation plots Best -Mensaje original- De: R-sig-ecology En nombre de Bede-Fazekas Ákos Enviado el: lunes, 23 de marzo de 2020 18:46 Para: r-sig-ecology@r-project.org Asunto: Re: [R-sig-eco] correlation plot in color Dear Manuel, and what happens if you use pairs() instead of chart.Correlation()? Is it colored? If yes, then it is a possible bug in function chart.Correlation(). Best, Ákos 2020.03.23. 17:20 keltezéssel, Manuel Esteban Lucas Borja írta: Thanks Ákos, I did as you mentioned: is.factor(libro1$Treat) [1] FALSE libro1$Treat <- as.factor(libro1$Treat) palette <- setNames(object = c(“red”, “green3”, “black”, “blue”), nm = levels (Libro1$Treat)) chart.Correlation(libro1[,1:4], histogram = T, pch = 19, bg = palette[Libro1$Treat]) But nothing happens. I got again the correlation plot but doc values are not in colour following the Treat classification Thanks for your time. Best Manuel -Mensaje original- De: R-sig-ecology En nombre de Bede-Fazekas Ákos Enviado el: lunes, 23 de marzo de 2020 14:54 Para: r-sig-ecology@r-project.org Asunto: Re: [R-sig-eco] correlation plot in color Dear Manuel, are you sure that Libro1$Treat is really a categorical column (instead of character)? The example code that you sent us works for categorical data: is.factor(get(data(iris))$Species) TRUE If is.factor(Libro1$Treat) is FALSE, then you should convert it from character to factor, before creating the color palette and calling chart.Correlation(): Libro1$Treat <- as.factor(Libro1$Treat) Have a nice week, Ákos 2020.03.23. 11:19 keltezéssel, Manuel Esteban Lucas Borja írta: Thanks Mollie, I have retyped all commands but nothing happens at the end. No error backs and no colour in correlations plots. palette<-setNames(object = c("red", "green3", "black", "blue"), nm=levels(Libro1$Treat)) chart.Correlation(Libro1[,1:4], histogram=F, pch=21, bg=palette[Libro1$Treat]) Best Manuel -Mensaje original- De: Mollie Brooks Enviado el: lunes, 23 de marzo de 2020 11:04 Para: Manuel Esteban Lucas Borja CC: Bede-Fazekas Ákos ; r-sig-ecology@r-project.org Asunto: Re: [R-sig-eco] correlation plot in color It looks like the quotes are the fancy type (I can’t remember the official word for that). Try deleting and retyping all the quotes in that command. cheers, Mollie On 23Mar 2020, at 10:52, Manuel Esteban Lucas Borja wrote: Thanks Bede-Fazekas Ákos, Thanks a lot for your help. I have installed also the library (colorspace) I got the following error: palette <- setNames(object = c(“red”, “green3”, “black”, “blue”), nm =levels(u$Treat)) Error: unexpected input in "palette <- setNames(object = c(“" What can I do? Best Manuel -Mensaje original- De: R-sig-ecology En nombre de Bede-Fazekas Ákos Enviado el: lunes, 23 de marzo de 2020 6:52 Para: r-sig-ecology@r-project.org Asunto: Re: [R-sig-eco] correlation plot in color Dear Manuel, please try this: palette <- setNames(object = c(“red”, “green3”, “black”, “blue”), nm = levels(Libro$Treat)) chart.Correlation(Libro[,1:4], histogram = T, pch = 19, bg= palette[Libro$Treat]) Have a nice week, Ákos 2020.03.23. 2:40 keltezéssel, Salvador SANCHEZ COLON írta: Hi Manuel, I am glad that you managed to plot the correlation plots. Then, as for the colour argument, bg is the argument for setting the background color, not the symbols color; the argument controlling the symbols colour in plots is color. The error you get seems to be due to the fact that your command is missing a square bracket at the end. Still, I have never used the PerformanceAnalytics package before and I just do not know how to make the chart.Correlation function to use the color argument. My guess is that it is not designed to take such argument. Salvador Salvador SÁNCHEZ-COLÓN An indepe
Re: [R-sig-eco] correlation plot in color
Dear Manuel, and what happens if you use pairs() instead of chart.Correlation()? Is it colored? If yes, then it is a possible bug in function chart.Correlation(). Best, Ákos 2020.03.23. 17:20 keltezéssel, Manuel Esteban Lucas Borja írta: Thanks Ákos, I did as you mentioned: is.factor(libro1$Treat) [1] FALSE libro1$Treat <- as.factor(libro1$Treat) palette <- setNames(object = c(“red”, “green3”, “black”, “blue”), nm = levels (Libro1$Treat)) chart.Correlation(libro1[,1:4], histogram = T, pch = 19, bg = palette[Libro1$Treat]) But nothing happens. I got again the correlation plot but doc values are not in colour following the Treat classification Thanks for your time. Best Manuel -Mensaje original- De: R-sig-ecology En nombre de Bede-Fazekas Ákos Enviado el: lunes, 23 de marzo de 2020 14:54 Para: r-sig-ecology@r-project.org Asunto: Re: [R-sig-eco] correlation plot in color Dear Manuel, are you sure that Libro1$Treat is really a categorical column (instead of character)? The example code that you sent us works for categorical data: is.factor(get(data(iris))$Species) TRUE If is.factor(Libro1$Treat) is FALSE, then you should convert it from character to factor, before creating the color palette and calling chart.Correlation(): Libro1$Treat <- as.factor(Libro1$Treat) Have a nice week, Ákos 2020.03.23. 11:19 keltezéssel, Manuel Esteban Lucas Borja írta: Thanks Mollie, I have retyped all commands but nothing happens at the end. No error backs and no colour in correlations plots. palette<-setNames(object = c("red", "green3", "black", "blue"), nm=levels(Libro1$Treat)) chart.Correlation(Libro1[,1:4], histogram=F, pch=21, bg=palette[Libro1$Treat]) Best Manuel -Mensaje original- De: Mollie Brooks Enviado el: lunes, 23 de marzo de 2020 11:04 Para: Manuel Esteban Lucas Borja CC: Bede-Fazekas Ákos ; r-sig-ecology@r-project.org Asunto: Re: [R-sig-eco] correlation plot in color It looks like the quotes are the fancy type (I can’t remember the official word for that). Try deleting and retyping all the quotes in that command. cheers, Mollie On 23Mar 2020, at 10:52, Manuel Esteban Lucas Borja wrote: Thanks Bede-Fazekas Ákos, Thanks a lot for your help. I have installed also the library (colorspace) I got the following error: palette <- setNames(object = c(“red”, “green3”, “black”, “blue”), nm =levels(u$Treat)) Error: unexpected input in "palette <- setNames(object = c(“" What can I do? Best Manuel -Mensaje original- De: R-sig-ecology En nombre de Bede-Fazekas Ákos Enviado el: lunes, 23 de marzo de 2020 6:52 Para: r-sig-ecology@r-project.org Asunto: Re: [R-sig-eco] correlation plot in color Dear Manuel, please try this: palette <- setNames(object = c(“red”, “green3”, “black”, “blue”), nm = levels(Libro$Treat)) chart.Correlation(Libro[,1:4], histogram = T, pch = 19, bg= palette[Libro$Treat]) Have a nice week, Ákos 2020.03.23. 2:40 keltezéssel, Salvador SANCHEZ COLON írta: Hi Manuel, I am glad that you managed to plot the correlation plots. Then, as for the colour argument, bg is the argument for setting the background color, not the symbols color; the argument controlling the symbols colour in plots is color. The error you get seems to be due to the fact that your command is missing a square bracket at the end. Still, I have never used the PerformanceAnalytics package before and I just do not know how to make the chart.Correlation function to use the color argument. My guess is that it is not designed to take such argument. Salvador Salvador SÁNCHEZ-COLÓN An independent consultant Statistics, GIS, RS En Dom, 22 Marzo, 2020 en 16:42, Manuel Esteban Lucas Borja escribió: Para: Salvador SANCHEZ COLON Cc: bfalevl...@gmail.com; r-sig-ecology@r-project.org Thanks Salvador, It Works properly and I was able to do the correlation plots excluding the categorical variable as you mentioned. In relation to colours I found the following information from other websites: data(iris) pairs(iris[1:4], main = "Data(iris) -- 3 Especies", pch = 21,bg = c("red", "green3", "blue")[codes(iris$Species)]) So the argument bg should be used for adding colours to the correlation plot. bg= c(“red”, “green3”,“blue”)[codes(iris$Species) I tried this with my dataset: chart.Correlation(Libro[,1:4], histogram = T, pch = 19, bg= c(“red”, “green3”, “black” “blue”)[codes(Libro$Treat)) Results: Error: unexpected input in "chart.Correlation(u[,1:4], histogram = T, pch = 19, bg= c(“" “blue”)[codes(u$Treat)) Error: unexpected input in " “" Thanks a lot for your time! Best Manuel *De:*Salvador SANCHEZ COLON *Enviado el:* domingo, 22 de marzo de 2020 19:25 *Para:* Manuel Esteban Lucas Borja *CC:* bfalevl...@gmail.com; r-sig-ecology@r-project.org *Asunto:* Re: [R-sig-eco] correlation plot in color Hola Manuel: A
Re: [R-sig-eco] correlation plot in color
Thanks Ákos, I did as you mentioned: > is.factor(libro1$Treat) [1] FALSE > libro1$Treat <- as.factor(libro1$Treat) > palette <- setNames(object = c(“red”, “green3”, “black”, “blue”), nm = levels > (Libro1$Treat)) > chart.Correlation(libro1[,1:4], histogram = T, pch = 19, bg = > palette[Libro1$Treat]) But nothing happens. I got again the correlation plot but doc values are not in colour following the Treat classification Thanks for your time. Best Manuel -Mensaje original- De: R-sig-ecology En nombre de Bede-Fazekas Ákos Enviado el: lunes, 23 de marzo de 2020 14:54 Para: r-sig-ecology@r-project.org Asunto: Re: [R-sig-eco] correlation plot in color Dear Manuel, are you sure that Libro1$Treat is really a categorical column (instead of character)? The example code that you sent us works for categorical data: is.factor(get(data(iris))$Species) TRUE If is.factor(Libro1$Treat) is FALSE, then you should convert it from character to factor, before creating the color palette and calling chart.Correlation(): Libro1$Treat <- as.factor(Libro1$Treat) Have a nice week, Ákos 2020.03.23. 11:19 keltezéssel, Manuel Esteban Lucas Borja írta: > Thanks Mollie, > > I have retyped all commands but nothing happens at the end. No error backs > and no colour in correlations plots. > > >> palette<-setNames(object = c("red", "green3", "black", "blue"), >> nm=levels(Libro1$Treat)) chart.Correlation(Libro1[,1:4], histogram=F, >> pch=21, bg=palette[Libro1$Treat]) > Best > Manuel > > > > > -Mensaje original- > De: Mollie Brooks Enviado el: lunes, 23 de > marzo de 2020 11:04 > Para: Manuel Esteban Lucas Borja > CC: Bede-Fazekas Ákos ; > r-sig-ecology@r-project.org > Asunto: Re: [R-sig-eco] correlation plot in color > > It looks like the quotes are the fancy type (I can’t remember the official > word for that). Try deleting and retyping all the quotes in that command. > > cheers, > Mollie > >> On 23Mar 2020, at 10:52, Manuel Esteban Lucas Borja >> wrote: >> >> Thanks Bede-Fazekas Ákos, >> Thanks a lot for your help. >> >> I have installed also the library (colorspace) I got the following >> error: >> >>> palette <- setNames(object = c(“red”, “green3”, “black”, “blue”), nm >>> =levels(u$Treat)) >> Error: unexpected input in "palette <- setNames(object = c(“" >> >> What can I do? >> Best >> Manuel >> >> >> -Mensaje original- >> De: R-sig-ecology En nombre de >> Bede-Fazekas Ákos Enviado el: lunes, 23 de marzo de 2020 6:52 >> Para: r-sig-ecology@r-project.org >> Asunto: Re: [R-sig-eco] correlation plot in color >> >> Dear Manuel, >> >> please try this: >> palette <- setNames(object = c(“red”, “green3”, “black”, “blue”), nm >> = >> levels(Libro$Treat)) >> chart.Correlation(Libro[,1:4], histogram = T, pch = 19, bg= >> palette[Libro$Treat]) >> >> Have a nice week, >> Ákos >> >> 2020.03.23. 2:40 keltezéssel, Salvador SANCHEZ COLON írta: >>> Hi Manuel, >>> >>> >>> I am glad that you managed to plot the correlation plots. Then, as >>> for the colour argument, bg is the argument for setting the >>> background color, not the symbols color; the argument controlling >>> the symbols colour in plots is color. The error you get seems to be >>> due to the fact that your command is missing a square bracket at the end. >>> >>> >>> Still, I have never used the PerformanceAnalytics package before and >>> I just do not know how to make the chart.Correlation function to use >>> the color argument. My guess is that it is not designed to take such >>> argument. >>> >>> >>> Salvador >>> >>> >>> Salvador SÁNCHEZ-COLÓN >>> >>> An independent consultant >>> >>> Statistics, GIS, RS >>> >>> >>> >>> En Dom, 22 Marzo, 2020 en 16:42, Manuel Esteban Lucas Borja >>> escribió: >>> Para: Salvador SANCHEZ COLON >>> Cc: bfalevl...@gmail.com; r-sig-ecology@r-project.org >>> >>> Thanks Salvador, >>> >>> It Works properly and I was able to do the correlation plots >>> excluding the categorical variable as you mentioned. In relation to >>> colours I found the following information from other websites: >>> >>>> data(iris) >>>> pairs(iris[1:4], main = "Data(iris) -- 3 Especies", pch = 21,bg = >>> c("red",
Re: [R-sig-eco] correlation plot in color
Dear Manuel, are you sure that Libro1$Treat is really a categorical column (instead of character)? The example code that you sent us works for categorical data: is.factor(get(data(iris))$Species) TRUE If is.factor(Libro1$Treat) is FALSE, then you should convert it from character to factor, before creating the color palette and calling chart.Correlation(): Libro1$Treat <- as.factor(Libro1$Treat) Have a nice week, Ákos 2020.03.23. 11:19 keltezéssel, Manuel Esteban Lucas Borja írta: Thanks Mollie, I have retyped all commands but nothing happens at the end. No error backs and no colour in correlations plots. palette<-setNames(object = c("red", "green3", "black", "blue"), nm=levels(Libro1$Treat)) chart.Correlation(Libro1[,1:4], histogram=F, pch=21, bg=palette[Libro1$Treat]) Best Manuel -Mensaje original- De: Mollie Brooks Enviado el: lunes, 23 de marzo de 2020 11:04 Para: Manuel Esteban Lucas Borja CC: Bede-Fazekas Ákos ; r-sig-ecology@r-project.org Asunto: Re: [R-sig-eco] correlation plot in color It looks like the quotes are the fancy type (I can’t remember the official word for that). Try deleting and retyping all the quotes in that command. cheers, Mollie On 23Mar 2020, at 10:52, Manuel Esteban Lucas Borja wrote: Thanks Bede-Fazekas Ákos, Thanks a lot for your help. I have installed also the library (colorspace) I got the following error: palette <- setNames(object = c(“red”, “green3”, “black”, “blue”), nm =levels(u$Treat)) Error: unexpected input in "palette <- setNames(object = c(“" What can I do? Best Manuel -Mensaje original- De: R-sig-ecology En nombre de Bede-Fazekas Ákos Enviado el: lunes, 23 de marzo de 2020 6:52 Para: r-sig-ecology@r-project.org Asunto: Re: [R-sig-eco] correlation plot in color Dear Manuel, please try this: palette <- setNames(object = c(“red”, “green3”, “black”, “blue”), nm = levels(Libro$Treat)) chart.Correlation(Libro[,1:4], histogram = T, pch = 19, bg= palette[Libro$Treat]) Have a nice week, Ákos 2020.03.23. 2:40 keltezéssel, Salvador SANCHEZ COLON írta: Hi Manuel, I am glad that you managed to plot the correlation plots. Then, as for the colour argument, bg is the argument for setting the background color, not the symbols color; the argument controlling the symbols colour in plots is color. The error you get seems to be due to the fact that your command is missing a square bracket at the end. Still, I have never used the PerformanceAnalytics package before and I just do not know how to make the chart.Correlation function to use the color argument. My guess is that it is not designed to take such argument. Salvador Salvador SÁNCHEZ-COLÓN An independent consultant Statistics, GIS, RS En Dom, 22 Marzo, 2020 en 16:42, Manuel Esteban Lucas Borja escribió: Para: Salvador SANCHEZ COLON Cc: bfalevl...@gmail.com; r-sig-ecology@r-project.org Thanks Salvador, It Works properly and I was able to do the correlation plots excluding the categorical variable as you mentioned. In relation to colours I found the following information from other websites: data(iris) pairs(iris[1:4], main = "Data(iris) -- 3 Especies", pch = 21,bg = c("red", "green3", "blue")[codes(iris$Species)]) So the argument bg should be used for adding colours to the correlation plot. bg= c(“red”, “green3”,“blue”)[codes(iris$Species) I tried this with my dataset: chart.Correlation(Libro[,1:4], histogram = T, pch = 19, bg= c(“red”, “green3”, “black” “blue”)[codes(Libro$Treat)) Results: Error: unexpected input in "chart.Correlation(u[,1:4], histogram = T, pch = 19, bg= c(“" “blue”)[codes(u$Treat)) Error: unexpected input in " “" Thanks a lot for your time! Best Manuel *De:*Salvador SANCHEZ COLON *Enviado el:* domingo, 22 de marzo de 2020 19:25 *Para:* Manuel Esteban Lucas Borja *CC:* bfalevl...@gmail.com; r-sig-ecology@r-project.org *Asunto:* Re: [R-sig-eco] 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 mailto:manuelesteban.lu...@uclm.es>> escribió: Para: Bede-Fazekas Ákos; r-sig-ecology@r-project.org <mailto:r-sig-ecology@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
Re: [R-sig-eco] correlation plot in color
It looks like the quotes are the fancy type (I can’t remember the official word for that). Try deleting and retyping all the quotes in that command. cheers, Mollie > On 23Mar 2020, at 10:52, Manuel Esteban Lucas Borja > wrote: > > Thanks Bede-Fazekas Ákos, > Thanks a lot for your help. > > I have installed also the library (colorspace) > I got the following error: > >> palette <- setNames(object = c(“red”, “green3”, “black”, “blue”), nm >> =levels(u$Treat)) > > Error: unexpected input in "palette <- setNames(object = c(“" > > What can I do? > Best > Manuel > > > -Mensaje original- > De: R-sig-ecology En nombre de > Bede-Fazekas Ákos > Enviado el: lunes, 23 de marzo de 2020 6:52 > Para: r-sig-ecology@r-project.org > Asunto: Re: [R-sig-eco] correlation plot in color > > Dear Manuel, > > please try this: > palette <- setNames(object = c(“red”, “green3”, “black”, “blue”), nm = > levels(Libro$Treat)) > chart.Correlation(Libro[,1:4], histogram = T, pch = 19, bg= > palette[Libro$Treat]) > > Have a nice week, > Ákos > > 2020.03.23. 2:40 keltezéssel, Salvador SANCHEZ COLON írta: >> >> Hi Manuel, >> >> >> I am glad that you managed to plot the correlation plots. Then, as for >> the colour argument, bg is the argument for setting the background >> color, not the symbols color; the argument controlling the symbols >> colour in plots is color. The error you get seems to be due to the >> fact that your command is missing a square bracket at the end. >> >> >> Still, I have never used the PerformanceAnalytics package before and I >> just do not know how to make the chart.Correlation function to use the >> color argument. My guess is that it is not designed to take such argument. >> >> >> Salvador >> >> >> Salvador SÁNCHEZ-COLÓN >> >> An independent consultant >> >> Statistics, GIS, RS >> >> >> >> En Dom, 22 Marzo, 2020 en 16:42, Manuel Esteban Lucas Borja >> escribió: >> Para: Salvador SANCHEZ COLON >> Cc: bfalevl...@gmail.com; r-sig-ecology@r-project.org >> >> Thanks Salvador, >> >> It Works properly and I was able to do the correlation plots excluding >> the categorical variable as you mentioned. In relation to colours I >> found the following information from other websites: >> >>> data(iris) >> >>> pairs(iris[1:4], main = "Data(iris) -- 3 Especies", pch = 21,bg = >> c("red", "green3", "blue")[codes(iris$Species)]) >> >> So the argument bg should be used for adding colours to the >> correlation plot. >> >> bg= c(“red”, “green3”,“blue”)[codes(iris$Species) >> >> I tried this with my dataset: >> >> chart.Correlation(Libro[,1:4], histogram = T, pch = 19, bg= c(“red”, >> “green3”, “black” “blue”)[codes(Libro$Treat)) >> >> Results: >> >> Error: unexpected input in "chart.Correlation(u[,1:4], histogram = T, >> pch = 19, bg= c(“" >> >>> >>> “blue”)[codes(u$Treat)) >> >> Error: unexpected input in " “" >> >> Thanks a lot for your time! >> >> Best >> >> Manuel >> >> *De:*Salvador SANCHEZ COLON >> *Enviado el:* domingo, 22 de marzo de 2020 19:25 >> *Para:* Manuel Esteban Lucas Borja >> *CC:* bfalevl...@gmail.com; r-sig-ecology@r-project.org >> *Asunto:* Re: [R-sig-eco] 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 >> mailto:manuelesteban.lu...@uclm.es>> >> escribió: >> >> Para: Bede-Fazekas Ákos; r-sig-ecology@r-project.org >> <mailto:r-sig-ecology@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(PerformanceAna
Re: [R-sig-eco] correlation plot in color
Thanks Mollie, I have retyped all commands but nothing happens at the end. No error backs and no colour in correlations plots. > palette<-setNames(object = c("red", "green3", "black", "blue"), > nm=levels(Libro1$Treat)) > chart.Correlation(Libro1[,1:4], histogram=F, pch=21, bg=palette[Libro1$Treat]) Best Manuel -Mensaje original- De: Mollie Brooks Enviado el: lunes, 23 de marzo de 2020 11:04 Para: Manuel Esteban Lucas Borja CC: Bede-Fazekas Ákos ; r-sig-ecology@r-project.org Asunto: Re: [R-sig-eco] correlation plot in color It looks like the quotes are the fancy type (I can’t remember the official word for that). Try deleting and retyping all the quotes in that command. cheers, Mollie > On 23Mar 2020, at 10:52, Manuel Esteban Lucas Borja > wrote: > > Thanks Bede-Fazekas Ákos, > Thanks a lot for your help. > > I have installed also the library (colorspace) I got the following > error: > >> palette <- setNames(object = c(“red”, “green3”, “black”, “blue”), nm >> =levels(u$Treat)) > > Error: unexpected input in "palette <- setNames(object = c(“" > > What can I do? > Best > Manuel > > > -Mensaje original- > De: R-sig-ecology En nombre de > Bede-Fazekas Ákos Enviado el: lunes, 23 de marzo de 2020 6:52 > Para: r-sig-ecology@r-project.org > Asunto: Re: [R-sig-eco] correlation plot in color > > Dear Manuel, > > please try this: > palette <- setNames(object = c(“red”, “green3”, “black”, “blue”), nm = > levels(Libro$Treat)) > chart.Correlation(Libro[,1:4], histogram = T, pch = 19, bg= > palette[Libro$Treat]) > > Have a nice week, > Ákos > > 2020.03.23. 2:40 keltezéssel, Salvador SANCHEZ COLON írta: >> >> Hi Manuel, >> >> >> I am glad that you managed to plot the correlation plots. Then, as >> for the colour argument, bg is the argument for setting the >> background color, not the symbols color; the argument controlling the >> symbols colour in plots is color. The error you get seems to be due >> to the fact that your command is missing a square bracket at the end. >> >> >> Still, I have never used the PerformanceAnalytics package before and >> I just do not know how to make the chart.Correlation function to use >> the color argument. My guess is that it is not designed to take such >> argument. >> >> >> Salvador >> >> >> Salvador SÁNCHEZ-COLÓN >> >> An independent consultant >> >> Statistics, GIS, RS >> >> >> >> En Dom, 22 Marzo, 2020 en 16:42, Manuel Esteban Lucas Borja >> escribió: >> Para: Salvador SANCHEZ COLON >> Cc: bfalevl...@gmail.com; r-sig-ecology@r-project.org >> >> Thanks Salvador, >> >> It Works properly and I was able to do the correlation plots >> excluding the categorical variable as you mentioned. In relation to >> colours I found the following information from other websites: >> >>> data(iris) >> >>> pairs(iris[1:4], main = "Data(iris) -- 3 Especies", pch = 21,bg = >> c("red", "green3", "blue")[codes(iris$Species)]) >> >> So the argument bg should be used for adding colours to the >> correlation plot. >> >> bg= c(“red”, “green3”,“blue”)[codes(iris$Species) >> >> I tried this with my dataset: >> >> chart.Correlation(Libro[,1:4], histogram = T, pch = 19, bg= c(“red”, >> “green3”, “black” “blue”)[codes(Libro$Treat)) >> >> Results: >> >> Error: unexpected input in "chart.Correlation(u[,1:4], histogram = T, >> pch = 19, bg= c(“" >> >>> >>> “blue”)[codes(u$Treat)) >> >> Error: unexpected input in " “" >> >> Thanks a lot for your time! >> >> Best >> >> Manuel >> >> *De:*Salvador SANCHEZ COLON >> *Enviado el:* domingo, 22 de marzo de 2020 19:25 >> *Para:* Manuel Esteban Lucas Borja >> *CC:* bfalevl...@gmail.com; r-sig-ecology@r-project.org >> *Asunto:* Re: [R-sig-eco] 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 >> >> B
Re: [R-sig-eco] correlation plot in color
Dear Bede-Fazekas, I changed " by ' as I wrote below and nothing happens. No error back but the plot in not in colours. > palette <- setNames(object = c ('red', 'green3', 'black', 'blue'), nm > =levels(w$Treat)) > chart.Correlation(Libro1[,1:4], histogram = F, pch = 19, > bg=palette[Libro1$Treat]) Best Manuel -Mensaje original- De: R-sig-ecology En nombre de Bede-Fazekas Ákos Enviado el: lunes, 23 de marzo de 2020 6:52 Para: r-sig-ecology@r-project.org Asunto: Re: [R-sig-eco] correlation plot in color Dear Manuel, please try this: palette <- setNames(object = c(“red”, “green3”, “black”, “blue”), nm = levels(Libro$Treat)) chart.Correlation(Libro[,1:4], histogram = T, pch = 19, bg= palette[Libro$Treat]) Have a nice week, Ákos 2020.03.23. 2:40 keltezéssel, Salvador SANCHEZ COLON írta: > > Hi Manuel, > > > I am glad that you managed to plot the correlation plots. Then, as for > the colour argument, bg is the argument for setting the background > color, not the symbols color; the argument controlling the symbols > colour in plots is color. The error you get seems to be due to the > fact that your command is missing a square bracket at the end. > > > Still, I have never used the PerformanceAnalytics package before and I > just do not know how to make the chart.Correlation function to use the > color argument. My guess is that it is not designed to take such argument. > > > Salvador > > > Salvador SÁNCHEZ-COLÓN > > An independent consultant > > Statistics, GIS, RS > > > > En Dom, 22 Marzo, 2020 en 16:42, Manuel Esteban Lucas Borja > escribió: > Para: Salvador SANCHEZ COLON > Cc: bfalevl...@gmail.com; r-sig-ecology@r-project.org > > Thanks Salvador, > > It Works properly and I was able to do the correlation plots excluding > the categorical variable as you mentioned. In relation to colours I > found the following information from other websites: > > > data(iris) > > > pairs(iris[1:4], main = "Data(iris) -- 3 Especies", pch = 21,bg = > c("red", "green3", "blue")[codes(iris$Species)]) > > So the argument bg should be used for adding colours to the > correlation plot. > > bg= c(“red”, “green3”,“blue”)[codes(iris$Species) > > I tried this with my dataset: > > chart.Correlation(Libro[,1:4], histogram = T, pch = 19, bg= c(“red”, > “green3”, “black” “blue”)[codes(Libro$Treat)) > > Results: > > Error: unexpected input in "chart.Correlation(u[,1:4], histogram = T, > pch = 19, bg= c(“" > > > > > “blue”)[codes(u$Treat)) > > Error: unexpected input in " “" > > Thanks a lot for your time! > > Best > > Manuel > > *De:*Salvador SANCHEZ COLON > *Enviado el:* domingo, 22 de marzo de 2020 19:25 > *Para:* Manuel Esteban Lucas Borja > *CC:* bfalevl...@gmail.com; r-sig-ecology@r-project.org > *Asunto:* Re: [R-sig-eco] 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 > mailto:manuelesteban.lu...@uclm.es>> > escribió: > > Para: Bede-Fazekas Ákos; r-sig-ecology@r-project.org > <mailto:r-sig-ecology@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: > > > chart.Correlation(Libro1, histogram = F, pch = 19) > > 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 <mailto:r-sig-ecology-boun...@r-project.org>> En nombre de > Bede-Fazekas Ákos Enviado el: domingo, 22 de marzo de 2020 16:5
Re: [R-sig-eco] correlation plot in color
Thanks Salvador, Let see if I am able to fix it with the help of specialist Best Manuel Por favor, no imprima este documento si no es estrictamente necesario. Cuidar el medioambiente es responsabilidad de todos. Este mensaje de correo electrónico puede contener información confidencial de la UCLM, siendo para uso exclusivo del destinatario. Si usted lo ha recibido por error y no es el destinatario del mensaje, le rogamos que no difunda su contenido y lo comunique al remitente. Please do not print this document unless absolutely necessary. Environmental protection is in our hands. This e-mail may contain confidential information of the UCLM and is exclusively intended for the addressee. If you have received it by mistake and are not the intended recipient, do not send the contents and please notify the sender. De: Salvador SANCHEZ COLON Enviado el: lunes, 23 de marzo de 2020 2:41 Para: Manuel Esteban Lucas Borja CC: bfalevl...@gmail.com; r-sig-ecology@r-project.org Asunto: RE: [R-sig-eco] correlation plot in color Hi Manuel, I am glad that you managed to plot the correlation plots. Then, as for the colour argument, bg is the argument for setting the background color, not the symbols color; the argument controlling the symbols colour in plots is color. The error you get seems to be due to the fact that your command is missing a square bracket at the end. Still, I have never used the PerformanceAnalytics package before and I just do not know how to make the chart.Correlation function to use the color argument. My guess is that it is not designed to take such argument. Salvador Salvador SÁNCHEZ-COLÓN An independent consultant Statistics, GIS, RS En Dom, 22 Marzo, 2020 en 16:42, Manuel Esteban Lucas Borja mailto:manuelesteban.lu...@uclm.es>> escribió: Para: Salvador SANCHEZ COLON Cc: bfalevl...@gmail.com<mailto:bfalevl...@gmail.com>; r-sig-ecology@r-project.org<mailto:r-sig-ecology@r-project.org> Thanks Salvador, It Works properly and I was able to do the correlation plots excluding the categorical variable as you mentioned. In relation to colours I found the following information from other websites: > data(iris) > pairs(iris[1:4], main = "Data(iris) -- 3 Especies", pch = 21,bg = c("red", > "green3", "blue")[codes(iris$Species)]) So the argument bg should be used for adding colours to the correlation plot. bg= c(“red”, “green3”,“blue”)[codes(iris$Species) I tried this with my dataset: chart.Correlation(Libro[,1:4], histogram = T, pch = 19, bg= c(“red”, “green3”, “black” “blue”)[codes(Libro$Treat)) Results: Error: unexpected input in "chart.Correlation(u[,1:4], histogram = T, pch = 19, bg= c(“" > > “blue”)[codes(u$Treat)) Error: unexpected input in " “" Thanks a lot for your time! Best Manuel De: Salvador SANCHEZ COLON mailto:salvadorsanchezco...@prodigy.net.mx>> Enviado el: domingo, 22 de marzo de 2020 19:25 Para: Manuel Esteban Lucas Borja mailto:manuelesteban.lu...@uclm.es>> CC: bfalevl...@gmail.com<mailto:bfalevl...@gmail.com>; r-sig-ecology@r-project.org<mailto:r-sig-ecology@r-project.org> Asunto: Re: [R-sig-eco] 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 mailto:manuelesteban.lu...@uclm.es>> escribió: Para: Bede-Fazekas Ákos; r-sig-ecology@r-project.org<mailto:r-sig-ecology@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: > chart.Correlation(Libro1, histogram = F, pch = 19) 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 mailto:r-sig-ecology-boun...@r-project.org>> En nombre de Bede-Fazekas Ákos Enviado el: domingo, 22 de marzo de 2020 16:57 Para: r-sig-ecology@r-project.org<mail
Re: [R-sig-eco] correlation plot in color
Thanks Bede-Fazekas Ákos, Thanks a lot for your help. I have installed also the library (colorspace) I got the following error: > palette <- setNames(object = c(“red”, “green3”, “black”, “blue”), nm > =levels(u$Treat)) Error: unexpected input in "palette <- setNames(object = c(“" What can I do? Best Manuel -Mensaje original- De: R-sig-ecology En nombre de Bede-Fazekas Ákos Enviado el: lunes, 23 de marzo de 2020 6:52 Para: r-sig-ecology@r-project.org Asunto: Re: [R-sig-eco] correlation plot in color Dear Manuel, please try this: palette <- setNames(object = c(“red”, “green3”, “black”, “blue”), nm = levels(Libro$Treat)) chart.Correlation(Libro[,1:4], histogram = T, pch = 19, bg= palette[Libro$Treat]) Have a nice week, Ákos 2020.03.23. 2:40 keltezéssel, Salvador SANCHEZ COLON írta: > > Hi Manuel, > > > I am glad that you managed to plot the correlation plots. Then, as for > the colour argument, bg is the argument for setting the background > color, not the symbols color; the argument controlling the symbols > colour in plots is color. The error you get seems to be due to the > fact that your command is missing a square bracket at the end. > > > Still, I have never used the PerformanceAnalytics package before and I > just do not know how to make the chart.Correlation function to use the > color argument. My guess is that it is not designed to take such argument. > > > Salvador > > > Salvador SÁNCHEZ-COLÓN > > An independent consultant > > Statistics, GIS, RS > > > > En Dom, 22 Marzo, 2020 en 16:42, Manuel Esteban Lucas Borja > escribió: > Para: Salvador SANCHEZ COLON > Cc: bfalevl...@gmail.com; r-sig-ecology@r-project.org > > Thanks Salvador, > > It Works properly and I was able to do the correlation plots excluding > the categorical variable as you mentioned. In relation to colours I > found the following information from other websites: > > > data(iris) > > > pairs(iris[1:4], main = "Data(iris) -- 3 Especies", pch = 21,bg = > c("red", "green3", "blue")[codes(iris$Species)]) > > So the argument bg should be used for adding colours to the > correlation plot. > > bg= c(“red”, “green3”,“blue”)[codes(iris$Species) > > I tried this with my dataset: > > chart.Correlation(Libro[,1:4], histogram = T, pch = 19, bg= c(“red”, > “green3”, “black” “blue”)[codes(Libro$Treat)) > > Results: > > Error: unexpected input in "chart.Correlation(u[,1:4], histogram = T, > pch = 19, bg= c(“" > > > > > “blue”)[codes(u$Treat)) > > Error: unexpected input in " “" > > Thanks a lot for your time! > > Best > > Manuel > > *De:*Salvador SANCHEZ COLON > *Enviado el:* domingo, 22 de marzo de 2020 19:25 > *Para:* Manuel Esteban Lucas Borja > *CC:* bfalevl...@gmail.com; r-sig-ecology@r-project.org > *Asunto:* Re: [R-sig-eco] 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 > mailto:manuelesteban.lu...@uclm.es>> > escribió: > > Para: Bede-Fazekas Ákos; r-sig-ecology@r-project.org > <mailto:r-sig-ecology@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: > > > chart.Correlation(Libro1, histogram = F, pch = 19) > > 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 <mailto:r-sig-ecology-boun...@r-project.org>> En nombre de > Bede-Fazekas Ákos Enviado el: domingo, 22 de marzo de 2020 16
Re: [R-sig-eco] correlation plot in color
Dear Manuel, please try this: palette <- setNames(object = c(“red”, “green3”, “black”, “blue”), nm = levels(Libro$Treat)) chart.Correlation(Libro[,1:4], histogram = T, pch = 19, bg= palette[Libro$Treat]) Have a nice week, Ákos 2020.03.23. 2:40 keltezéssel, Salvador SANCHEZ COLON írta: > > Hi Manuel, > > > I am glad that you managed to plot the correlation plots. Then, as for > the colour argument, bg is the argument for setting the background > color, not the symbols color; the argument controlling the symbols > colour in plots is color. The error you get seems to be due to the > fact that your command is missing a square bracket at the end. > > > Still, I have never used the PerformanceAnalytics package before and I > just do not know how to make the chart.Correlation function to use the > color argument. My guess is that it is not designed to take such argument. > > > Salvador > > > Salvador SÁNCHEZ-COLÓN > > An independent consultant > > Statistics, GIS, RS > > > > En Dom, 22 Marzo, 2020 en 16:42, Manuel Esteban Lucas Borja > escribió: > Para: Salvador SANCHEZ COLON > Cc: bfalevl...@gmail.com; r-sig-ecology@r-project.org > > Thanks Salvador, > > It Works properly and I was able to do the correlation plots excluding > the categorical variable as you mentioned. In relation to colours I > found the following information from other websites: > > > data(iris) > > > pairs(iris[1:4], main = "Data(iris) -- 3 Especies", pch = 21,bg = > c("red", "green3", "blue")[codes(iris$Species)]) > > So the argument bg should be used for adding colours to the > correlation plot. > > bg= c(“red”, “green3”,“blue”)[codes(iris$Species) > > I tried this with my dataset: > > chart.Correlation(Libro[,1:4], histogram = T, pch = 19, bg= c(“red”, > “green3”, “black” “blue”)[codes(Libro$Treat)) > > Results: > > Error: unexpected input in "chart.Correlation(u[,1:4], histogram = T, > pch = 19, bg= c(“" > > > > > “blue”)[codes(u$Treat)) > > Error: unexpected input in " “" > > Thanks a lot for your time! > > Best > > Manuel > > *De:*Salvador SANCHEZ COLON > *Enviado el:* domingo, 22 de marzo de 2020 19:25 > *Para:* Manuel Esteban Lucas Borja > *CC:* bfalevl...@gmail.com; r-sig-ecology@r-project.org > *Asunto:* Re: [R-sig-eco] 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 > mailto:manuelesteban.lu...@uclm.es>> > escribió: > > Para: Bede-Fazekas Ákos; r-sig-ecology@r-project.org > <mailto:r-sig-ecology@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: > > > chart.Correlation(Libro1, histogram = F, pch = 19) > > 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 <mailto:r-sig-ecology-boun...@r-project.org>> En nombre de > Bede-Fazekas Ákos > Enviado el: domingo, 22 de marzo de 2020 16:57 > Para: r-sig-ecology@r-project.org <mailto:r-sig-ecology@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 ordoere
Re: [R-sig-eco] correlation plot in color
Hi Manuel, I am glad that you managed to plot the correlation plots. Then, as for the colour argument, bg is the argument for setting the background color, not the symbols color; the argument controlling the symbols colour in plots is color. The error you get seems to be due to the fact that your command is missing a square bracket at the end. Still, I have never used the PerformanceAnalytics package before and I just do not know how to make the chart.Correlation function to use the color argument. My guess is that it is not designed to take such argument. Salvador Salvador SÁNCHEZ-COLÓN An independent consultant Statistics, GIS, RS En Dom, 22 Marzo, 2020 en 16:42, Manuel Esteban Lucas Borja escribió: Para: Salvador SANCHEZ COLON Cc: bfalevl...@gmail.com; r-sig-ecology@r-project.org Thanks Salvador, It Works properly and I was able to do the correlation plots excluding the categorical variable as you mentioned. In relation to colours I found the following information from other websites: > data(iris) > pairs(iris[1:4], main = "Data(iris) -- 3 Especies", pch = 21,bg = c("red", > "green3", "blue")[codes(iris$Species)]) So the argument bg should be used for adding colours to the correlation plot. bg= c(“red”, “green3”,“blue”)[codes(iris$Species) I tried this with my dataset: chart.Correlation(Libro[,1:4], histogram = T, pch = 19, bg= c(“red”, “green3”, “black” “blue”)[codes(Libro$Treat)) Results: Error: unexpected input in "chart.Correlation(u[,1:4], histogram = T, pch = 19, bg= c(“" > >“blue”)[codes(u$Treat)) Error: unexpected input in " “" Thanks a lot for your time! Best Manuel De: Salvador SANCHEZ COLON Enviado el: domingo, 22 de marzo de 2020 19:25 Para: Manuel Esteban Lucas Borja CC: bfalevl...@gmail.com; r-sig-ecology@r-project.org Asunto: Re: [R-sig-eco] 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 mailto:manuelesteban.lu...@uclm.es>> escribió: Para: Bede-Fazekas Ákos; r-sig-ecology@r-project.org<mailto:r-sig-ecology@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: > chart.Correlation(Libro1, histogram = F, pch = 19) 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 mailto:r-sig-ecology-boun...@r-project.org>> En nombre de Bede-Fazekas Ákos Enviado el: domingo, 22 de marzo de 2020 16:57 Para: r-sig-ecology@r-project.org<mailto:r-sig-ecology@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: > 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 > > > > > Manu
Re: [R-sig-eco] correlation plot in color
Thanks Salvador, It Works properly and I was able to do the correlation plots excluding the categorical variable as you mentioned. In relation to colours I found the following information from other websites: > data(iris) > pairs(iris[1:4], main = "Data(iris) -- 3 Especies", pch = 21,bg = c("red", > "green3", "blue")[codes(iris$Species)]) So the argument bg should be used for adding colours to the correlation plot. bg= c(“red”, “green3”,“blue”)[codes(iris$Species) I tried this with my dataset: chart.Correlation(Libro[,1:4], histogram = T, pch = 19, bg= c(“red”, “green3”, “black” “blue”)[codes(Libro$Treat)) Results: Error: unexpected input in "chart.Correlation(u[,1:4], histogram = T, pch = 19, bg= c(“" > > “blue”)[codes(u$Treat)) Error: unexpected input in " “" Thanks a lot for your time! Best Manuel De: Salvador SANCHEZ COLON Enviado el: domingo, 22 de marzo de 2020 19:25 Para: Manuel Esteban Lucas Borja CC: bfalevl...@gmail.com; r-sig-ecology@r-project.org Asunto: Re: [R-sig-eco] 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 mailto:manuelesteban.lu...@uclm.es>> escribió: Para: Bede-Fazekas Ákos; r-sig-ecology@r-project.org<mailto:r-sig-ecology@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: > chart.Correlation(Libro1, histogram = F, pch = 19) 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 mailto:r-sig-ecology-boun...@r-project.org>> En nombre de Bede-Fazekas Ákos Enviado el: domingo, 22 de marzo de 2020 16:57 Para: r-sig-ecology@r-project.org<mailto:r-sig-ecology@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: > 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 mailto:aty...@unl.edu>> > Sent: Sunday, March 22, 2020 2:12:31 PM > To: Manuel Esteban Lucas Borja > mailto:manuelesteban.lu...@uclm.es>>; > r-sig-ecology@r-project.org<mailto:r-sig-ecology@r-project.org> > mailto:r-sig-ecology@r-project.org>> > Subject: Re: [R-s
Re: [R-sig-eco] correlation plot in color
Ok. As for your problem with the categorical variable Treat, you just exclude it when calling the chart.Correlation function. Assuming that Treat is the fifth column in your data set, then: chart.Correlation(Libro1[,1:4], histogram = F, pch = 19) should do. However, I do not know how to make the chart.Correlation function to use another variable to map colour. Salvador Salvador SÁNCHEZ-COLÓN An independent consultant Statistics, GIS, RS En Dom, 22 Marzo, 2020 en 12:56, Manuel Esteban Lucas Borja escribió: Para: Salvador SANCHEZ COLON Cc: bfalevl...@gmail.com; r-sig-ecology@r-project.org Gracias Salvador, I tried this but the question is that I would like to obtain a composite plot containing all the correlation, histograms and point colours depending on the treat variable. Thanks for your time All the best M [Logotipo UCLM<http://www.uclm.es/comun/imgweb/firma_correo/uclm.jpg>]<http://www.uclm.es/> 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 | manuelesteban.lu...@uclm.es<mailto:manuelesteban.lu...@uclm.es> http://blog.uclm.es/manuelestebanlucas/ | Mensaje Instantáneo [ORCID<http://www.uclm.es/comun/imgweb/firma_correo/orcid.jpg>]<http://orcid.org/-0001-6270-8408> [Google Scholar<http://www.uclm.es/comun/imgweb/firma_correo/googlescholar.png>]<https://scholar.google.es/citations?user=VjvdjnQJhl=es> [In<http://www.uclm.es/comun/imgweb/firma_correo/in.jpg>]<https://www.linkedin.com/company/uclm> [Twitter<http://www.uclm.es/comun/imgweb/firma_correo/twitter.jpg>]<https://twitter.com/#!/uclm_es> [Facebook<http://www.uclm.es/comun/imgweb/firma_correo/facebook.jpg>]<https://www.facebook.com/uclm.es> [YouTube<http://www.uclm.es/comun/imgweb/firma_correo/youtube.png>]<https://www.youtube.com/user/UCLMvideos> Por favor, no imprima este documento si no es estrictamente necesario. Cuidar el medioambiente es responsabilidad de todos. Este mensaje de correo electrónico puede contener información confidencial de la UCLM, siendo para uso exclusivo del destinatario. Si usted lo ha recibido por error y no es el destinatario del mensaje, le rogamos que no difunda su contenido y lo comunique al remitente. Please do not print this document unless absolutely necessary. Environmental protection is in our hands. This e-mail may contain confidential information of the UCLM and is exclusively intended for the addressee. If you have received it by mistake and are not the intended recipient, do not send the contents and please notify the sender. De: Salvador SANCHEZ COLON Enviado el: domingo, 22 de marzo de 2020 19:25 Para: Manuel Esteban Lucas Borja CC: bfalevl...@gmail.com; r-sig-ecology@r-project.org Asunto: Re: [R-sig-eco] 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 mailto:manuelesteban.lu...@uclm.es>> escribió: Para: Bede-Fazekas Ákos; r-sig-ecology@r-project.org<mailto:r-sig-ecology@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: > chart.Correlation(Libro1, histogram = F, pch = 19) 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 mailto:r-sig-ecology-boun...@r-project.org>> En nombre de Bede-Fazekas Ákos Enviado el: domingo, 22 de marzo de 2020 16:57 Para: r-sig-ecology@r-project.org<mailto:r-sig-ecology@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 (r
Re: [R-sig-eco] correlation plot in color
Gracias Salvador, I tried this but the question is that I would like to obtain a composite plot containing all the correlation, histograms and point colours depending on the treat variable. Thanks for your time All the best M [Logotipo UCLM]<http://www.uclm.es/> 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 | manuelesteban.lu...@uclm.es<mailto:manuelesteban.lu...@uclm.es> http://blog.uclm.es/manuelestebanlucas/ | Mensaje Instantáneo [ORCID] <http://orcid.org/-0001-6270-8408>[Google Scholar] <https://scholar.google.es/citations?user=VjvdjnQJ=es> [In]<https://www.linkedin.com/company/uclm> [Twitter] <https://twitter.com/#!/uclm_es> [Facebook] <https://www.facebook.com/uclm.es> [YouTube] <https://www.youtube.com/user/UCLMvideos> Por favor, no imprima este documento si no es estrictamente necesario. Cuidar el medioambiente es responsabilidad de todos. Este mensaje de correo electrónico puede contener información confidencial de la UCLM, siendo para uso exclusivo del destinatario. Si usted lo ha recibido por error y no es el destinatario del mensaje, le rogamos que no difunda su contenido y lo comunique al remitente. Please do not print this document unless absolutely necessary. Environmental protection is in our hands. This e-mail may contain confidential information of the UCLM and is exclusively intended for the addressee. If you have received it by mistake and are not the intended recipient, do not send the contents and please notify the sender. De: Salvador SANCHEZ COLON Enviado el: domingo, 22 de marzo de 2020 19:25 Para: Manuel Esteban Lucas Borja CC: bfalevl...@gmail.com; r-sig-ecology@r-project.org Asunto: Re: [R-sig-eco] 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 mailto:manuelesteban.lu...@uclm.es>> escribió: Para: Bede-Fazekas Ákos; r-sig-ecology@r-project.org<mailto:r-sig-ecology@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: > chart.Correlation(Libro1, histogram = F, pch = 19) 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 mailto:r-sig-ecology-boun...@r-project.org>> En nombre de Bede-Fazekas Ákos Enviado el: domingo, 22 de marzo de 2020 16:57 Para: r-sig-ecology@r-project.org<mailto:r-sig-ecology@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: > 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 > > > &
Re: [R-sig-eco] 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 escribió: Para: Bede-Fazekas Ákos; r-sig-ecology@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: > chart.Correlation(Libro1, histogram = F, pch = 19) 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 En nombre de Bede-Fazekas Ákos Enviado el: domingo, 22 de marzo de 2020 16:57 Para: r-sig-ecology@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: > 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 > Sent: Sunday, March 22, 2020 2:12:31 PM > To: Manuel Esteban Lucas Borja ; > r-sig-ecology@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: aty...@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" > manuelesteban.lu...@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". > > > &g
Re: [R-sig-eco] correlation plot in color
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: > chart.Correlation(Libro1, histogram = F, pch = 19) 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 En nombre de Bede-Fazekas Ákos Enviado el: domingo, 22 de marzo de 2020 16:57 Para: r-sig-ecology@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: > 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 > Sent: Sunday, March 22, 2020 2:12:31 PM > To: Manuel Esteban Lucas Borja ; > r-sig-ecology@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: aty...@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" > manuelesteban.lu...@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 > >
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: 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 Sent: Sunday, March 22, 2020 2:12:31 PM To: Manuel Esteban Lucas Borja ; r-sig-ecology@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: aty...@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" 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@r-project.org https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_r-2Dsig-2Decology=DwIFAg=Cu5g146wZdoqVuKpTNsYHeFX_rg6kWhlkLF8Eft-wwo=aLEaSryyUcERVqcKVZl7lQ=8ZU0mK0lLpXPq2WJfDahUzu7C12RW7imeOWQ_rvGsiA=PaGMWGrC4sn6FfrSXEvZnzrBSounwJEENXLeoXL4Cjc= [[alternative HTML version deleted]] ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] correlation plot in color
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 Sent: Sunday, March 22, 2020 2:12:31 PM To: Manuel Esteban Lucas Borja ; r-sig-ecology@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: aty...@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" 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@r-project.org https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_r-2Dsig-2Decology=DwIFAg=Cu5g146wZdoqVuKpTNsYHeFX_rg6kWhlkLF8Eft-wwo=aLEaSryyUcERVqcKVZl7lQ=8ZU0mK0lLpXPq2WJfDahUzu7C12RW7imeOWQ_rvGsiA=PaGMWGrC4sn6FfrSXEvZnzrBSounwJEENXLeoXL4Cjc= [[alternative HTML version deleted]] ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] correlation plot in color
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@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology