如果标题不清楚,请提前道歉。我有一个如下的DF RatingScores:
head(RatingScores)
PP Condition QuoteType Rating Correct
1 pp1 Disfluent BS 3.15 7
2 pp1 Disfluent Motiv 4.15 7
3 pp10 Disfluent Motiv 3.75 6
4 pp10 Disfluent BS 1.45 6
5 pp11 Fluent Motiv 4.45 6
6 pp11 Fluent BS 3.50 6 我的目标是执行Rating和Correct之间的相关性分析,但我需要每个Condition * QuoteType因子的Rating。例如,将来自Disfluent*BS的Rating与Correct关联(即使用行1和行4)。我的第二个目标是在散点图上绘制这些相关性,并在图上绘制每条相关线。
到目前为止,我唯一的解决方案是相应地对数据进行子集,然后使用ggscatter绘制单独的图形,但是我不能使用par(new=TRUE)将它们相互覆盖。
到目前为止,我是这样对数据进行子集的:
DBS=subset(RatingScores,RatingScores$Condition=="Disfluent"&RatingScores$QuoteType=="BS")
FBS=subset(RatingScores,RatingScores$Condition=="Fluent"&RatingScores$QuoteType=="BS")
DMo=subset(RatingScores,RatingScores$Condition=="Disfluent"&RatingScores$QuoteType=="Motiv")
FMo=subset(RatingScores,RatingScores$Condition=="Fluent"&RatingScores$QuoteType=="Motiv")然后像这样画出每一个:
ggscatter(DMo, x = "Rating", y = "Correct",
add = "reg.line",point = F,color = "green", conf.int = F,
cor.coef = TRUE, cor.method = "pearson", title = "Disfluent Mo",
xlab = "Rating", ylab = "CRT Score")如果有更有效和更清晰的方法来做这件事,我将非常感谢任何帮助。提前谢谢。
发布于 2020-06-03 00:59:20
你在找这个吗?
ggscatter(RatingScores, x = "Rating", y = "Correct",
add = "reg.line",point = F,color = "green", conf.int = F,
cor.coef = TRUE, cor.method = "pearson", title = "Disfluent Mo",
xlab = "Rating", ylab = "CRT Score") +
facet_wrap(Condition ~ QuoteType)https://stackoverflow.com/questions/62153093
复制相似问题