本文へスキップ
からだにいいもの

Rのトピックスを中心に『まだ、まだ、知らない、役に立つ情報?』を発信します。

Analysis in R: Useful for expressing multivariable relationships! The “corrplot” package

This is an introduction to a package that is useful for expressing multivariable relationships. For basic use, the contents of the exsample command should be sufficient. For other options, see the package help.

This package is recommended because the plot contents can be easily changed at the top and bottom.

In addition, packages that use the ggplot2 package are also presented for your reference. Why not use them according to your preferences?

・Analysis in R: Useful for understanding multivariable relationships! The “ggcorrplot” package
 https://www.karada-good.net/analyticsr/r-381/

Package version is 0.9.2. Checked with R version 4.2.2.

Install Package

Run the following command.

#Install Package
install.packages("corrplot")
スポンサーリンク

Example

See the command and package help for details.

#Loading the library
library("corrplot")

#Correlation coefficient calculation: stat package; cor command
#Use "mtcars" from darasets package for data
CorResult <- cor(mtcars, method = "pearson")

#Plotting results: corrplot command
#Specify plot contents:method option;"circle","square","ellipse",
#"number","shade","color","pie"
#Specify plot position: type option;full,lower,upper
#Symbol color:col option
corrplot(corr = CorResult, method = "ellipse", type = "upper",
         col = colorRampPalette(c("#a87963", "#4b61ba"))(10))

#Plotting with different plot contents at top and bottom: corrplot.mixed command
#Specify the contents of the lower plot: lower;
#the specified contents are common to the corrplot command
#Specify the contents of the upper plot: lower;
#the specified contents are common to the corrplot command
#Symbol color:col option
corrplot.mixed(corr = CorResult, lower = "square", upper = "number",
               lower.col = colorRampPalette(c("#a87963", "#4b61ba"))(10),
               upper.col = colorRampPalette(c("#a87963", "#4b61ba"))(10))

Output Example

・corrplot command

corrplot

・corrplot.mixed command

corrplot.mixed

I hope this makes your analysis a little easier !!

スポンサーリンク
価格および配送状況は変更される場合があります。購入時は商品ページをご確認ください。
当サイトに表示されている商品情報はAmazonから提供されたものであり、更新または削除される場合があります。
karada-goodはAmazonアソシエイトとして、適格販売により収入を得ています。