[R] plots of correlation matrices
Hi, I want to do a visualisation of a matrix plot made up of several plots of correlation matrices (using corrplot()). My data is in csv format. Here's an example: id,category,attribute1,attribute2,attribute3,attribute4 661,SCHS,43.2,0,56.5,1 12202,SCHS,161.7,5.7,155,16 1182,SCHS,21.4,0,29,0 1356,SSS, 8.8182,0.1818,10.6667,0.6667 1864,SCHS,443.7273,9.9091,537,46 12360,SOA,6.6364,0,10,0 3382,SOA,7.1667,0,26,0.5 1033,SOA,63.9231,1.5385,91.5,11.5 14742,SSS,4.3846,0,8,0 12760,SSS,425.0714,1.7857,297.5,3.5 I can get rid of the id. But I need the 'category' as a way of distinguishing the various correlation matrices. I can do a plot of the correlation matrix using corrplot() function in the corrplot package (ignoring the id and category). But what I need is a matrix of the plots of each correlation matrix based on the category, ie I have three categories in the data, hence I will need three plots of the correlation matrix in one diagram (because the correlation matrix only makes sense if they are distinguished by category). Any help? Regards Gawesh [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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.
Re: [R] plots of correlation matrices
Hi, One way to do that is this (avoiding the use of a for loop): l.txt- id category attribute1 attribute2 attribute3 attribute4 661 SCHS 43.2 0 56.5 1 12202 SCHS 161.7 5.7 155 16 1182 SCHS 21.4 0 29 0 1356 SSS 8.8182 0.1818 10.6667 0.6667 1864 SCHS 443.7273 9.9091 537 46 12360 SOA 6.6364 0 10 0 3382 SOA 7.1667 0 26 0.5 1033 SOA 63.9231 1.5385 91.5 11.5 14742 SSS 4.3846 0 8 0 12760 SSS 425.0714 1.7857 297.5 3.5 dat.df - read.table(textConnection(l.txt), header=T, as.is = TRUE) closeAllConnections() dat.lt-by(dat.df[,3:6], dat.df$category, cor) lapply(dat.lt,corrplot) Regards, Carlos Ortega www.qualityexcellence.es 2011/10/11 gj gaw...@gmail.com Hi, I want to do a visualisation of a matrix plot made up of several plots of correlation matrices (using corrplot()). My data is in csv format. Here's an example: id,category,attribute1,attribute2,attribute3,attribute4 661,SCHS,43.2,0,56.5,1 12202,SCHS,161.7,5.7,155,16 1182,SCHS,21.4,0,29,0 1356,SSS, 8.8182,0.1818,10.6667,0.6667 1864,SCHS,443.7273,9.9091,537,46 12360,SOA,6.6364,0,10,0 3382,SOA,7.1667,0,26,0.5 1033,SOA,63.9231,1.5385,91.5,11.5 14742,SSS,4.3846,0,8,0 12760,SSS,425.0714,1.7857,297.5,3.5 I can get rid of the id. But I need the 'category' as a way of distinguishing the various correlation matrices. I can do a plot of the correlation matrix using corrplot() function in the corrplot package (ignoring the id and category). But what I need is a matrix of the plots of each correlation matrix based on the category, ie I have three categories in the data, hence I will need three plots of the correlation matrix in one diagram (because the correlation matrix only makes sense if they are distinguished by category). Any help? Regards Gawesh [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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.
Re: [R] plots of correlation matrices
Hi, One way to do that is this (avoiding the use of a for loop): l.txt- id category attribute1 attribute2 attribute3 attribute4 661 SCHS 43.2 0 56.5 1 12202 SCHS 161.7 5.7 155 16 1182 SCHS 21.4 0 29 0 1356 SSS 8.8182 0.1818 10.6667 0.6667 1864 SCHS 443.7273 9.9091 537 46 12360 SOA 6.6364 0 10 0 3382 SOA 7.1667 0 26 0.5 1033 SOA 63.9231 1.5385 91.5 11.5 14742 SSS 4.3846 0 8 0 12760 SSS 425.0714 1.7857 297.5 3.5 dat.df - read.table(textConnection(l.txt), header=T, as.is = TRUE) closeAllConnections() dat.lt-by(dat.df[,3:6], dat.df$category, cor) I guess Gawesh is looking for ?layout or ?par: par(mfrow=c(2,2)) lapply(dat.lt,corrplot) lapply(dat.lt,corrplot) Regards, Carlos Ortega www.qualityexcellence.es 2011/10/11 gj gaw...@gmail.com Hi, I want to do a visualisation of a matrix plot made up of several plots of correlation matrices (using corrplot()). My data is in csv format. Here's an example: id,category,attribute1,attribute2,attribute3,attribute4 661,SCHS,43.2,0,56.5,1 12202,SCHS,161.7,5.7,155,16 1182,SCHS,21.4,0,29,0 1356,SSS, 8.8182,0.1818,10.6667,0.6667 1864,SCHS,443.7273,9.9091,537,46 12360,SOA,6.6364,0,10,0 3382,SOA,7.1667,0,26,0.5 1033,SOA,63.9231,1.5385,91.5,11.5 14742,SSS,4.3846,0,8,0 12760,SSS,425.0714,1.7857,297.5,3.5 I can get rid of the id. But I need the 'category' as a way of distinguishing the various correlation matrices. I can do a plot of the correlation matrix using corrplot() function in the corrplot package (ignoring the id and category). But what I need is a matrix of the plots of each correlation matrix based on the category, ie I have three categories in the data, hence I will need three plots of the correlation matrix in one diagram (because the correlation matrix only makes sense if they are distinguished by category). Any help? Regards Gawesh [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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. __ R-help@r-project.org mailing list 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.