在X和y上都应用ggscatter都是双
struct Media {
let postKey: Int
let userId: Int
let mediaType: MediaType
}
let video = Media(postKey: 1, userId: 2, mediaType: .video(dataVariable))
let image = Media(postKey: 2, userId: 3, mediaType: .image(imageVariable))
导致: FUN(左,右)错误:仅适用于数字,逻辑或复杂类型
答案 0 :(得分:2)
我认为您的代码没有任何明显的问题,因此我想问题可能出在merged_clean
上,但是您的示例可以更好地运行,包括数据在内。对我来说
library(tidyverse)
library(ggpubr)
merged_clean <- tibble(
Doctors = c(1, 2, 3, 4, 5.5),
val = c(2.5, 3, 3, 4, 3.5))
ggscatter(merged_clean, x = "Doctors", y = "val",
add = "reg.line", conf.int = TRUE,
cor.coef = TRUE, cor.method = "pearson",
xlab = "Estimated Doctors Density per 1000",
ylab = "HIV Mortality rate per 100 0000")
产生
这是我所期望的