library(tidyverse)
dates <- c("2019-03-01", "2019-04-01", "2019-05-01", "2019-06-01", "2019-07-01")
d <- data_frame(month = dates %>% factor(ordered = TRUE),
subject = "Abc_14",
taux = runif(length(dates)),
volume = (runif(length(dates)) * 100) %>% as.integer())
d %>% glimpse()
Observations: 5
Variables: 4
$ month <ord> 2019-03-01, 2019-04-01, 2019-05-01, 2019-06-01, 2019-07-01
$ subject <chr> "Abc_14", "Abc_14", "Abc_14", "Abc_14", "Abc_14"
$ taux <dbl> 0.67040271, 0.85711442, 0.94608828, 0.65138723, 0.02835217
$ volume <int> 52, 46, 33, 17, 69
让我们看看这个失败的情节:
d %>%
ggplot(aes(volume, taux)) +
geom_density2d(size = .2) +
geom_point(aes(fill = subject)) +
geom_smooth(method = "lm", se = FALSE) +
facet_wrap(facets = vars(month), scales = "free") +
scale_y_continuous(labels = scales::percent, breaks = seq(0, 1, .2)) +
theme(legend.position = "none")
Error in prettyNum(.Internal(format(x, trim, digits, nsmall, width, 3L, : argument 'nsmall' incorrect
似乎有冲突
facet_wrap
和
scale_y_continuous
我能做点什么把他们都留下吗?
没有
scale_y_continous()
注:真实的数据帧大约有200行,大约30个受试者,大约10个月,还有一些缺失的组合。它还在生长。