我正在制作4个统计模型的图表,其中包含“病毒”变量。我不知道如何根据“病毒”变量放置图表的标题。
我做了这个可重复的集合:
library(dplyr)
library(tidyr)
library(lubridate)
library(mgcv)
library(purrr)
set.limpio <- data.frame(Codigo= 1:1000, Dia = rnorm(1000,100,2),
R = rbinom(1000,1,.5),
virus = c(rep("V1",250),
rep("V2",250),
rep("V3",250),
rep("V4",250)))
plots <- set.limpio %>%
filter(.$Dia < 250) %>%
split(.$virus) %>%
map(~ gam(R ~ s(Dia) + s(Codigo, bs = "re"), data = .,
family = binomial(link = "logit"), method = "REML")) %>%
map( ~ plot.gam(.,shade = T, scale = 0, scheme = 3,
xlab = "Days",
ylab = "Positivity"))
在这一节应该是标题
map( ~ plot.gam(.,shade = T, scale = 0,scheme = 3,xlab = "Days", ylab =
"Positivity", main = "here should be the title"))
我试过了:
main = paste(names(.))
还有
deparse(substitute(obj))
但它们都没有奏效。