问题在于您的数据格式。这是一个带有一些假数据的示例
library(tidyverse)
##Create some fake data
set.seed(3)
data <- tibble(
year = 1991:2020,
bm = rnorm(30),
bmsw = rnorm(30),
bmi = rnorm(30),
bmandinno = rnorm(30),
bmproc = rnorm(30),
bmart = rnorm(30)
)
##Gather the variables to create a long dataset
new_data <- data %>%
gather(model, value, -year)
##plot the data
ggplot(new_data, aes(x = year, y = value)) +
geom_point() +
geom_smooth(method = "lm", se = FALSE) +
facet_grid(~model)
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句