[英]How to use pairs.panel for only certain rows in the dataframe in R
I am trying to create a correlation panel using only specific rows. 我正在尝试仅使用特定行来创建关联面板。 I am using the native R dataframe "iris" and want to create three correlation panels that relate only to particular species.
我正在使用本地R数据框“ iris”,并希望创建三个仅与特定物种相关的关联面板。 This is my code:
这是我的代码:
library(psych)
pairs.panels(iris[iris$Species == "setosa",], lm=TRUE)
pairs.panels(iris[iris$Species == "versicolor",], lm=TRUE)
pairs.panels(iris[iris$Species == "virginica",], lm=TRUE)
Although I am getting a correlation panel for each specie separately, I keep getting this error: 尽管我分别获得了每个物种的相关性面板,但是我仍然收到此错误:
Error in int_abline(a = a, b = b, h = h, v = v, untf = untf, ...) : 'a' and 'b' must be finite
This is the error that appears on the correlation panel output (pls see link): error on panel 这是出现在相关面板输出上的错误(请参见链接): 面板上的错误
I already tried creating different dataframes that only contain the specific rows that I want. 我已经尝试创建仅包含所需特定行的其他数据框。 For example:
例如:
setosa <- iris[iris$Species == "setosa",]
pairs.panels(setosa, lm=TRUE)
But I still get the same error. 但是我仍然遇到同样的错误。
Would appreciate any help to try and get rid of the error. 将不胜感激,尝试并摆脱该错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.