【发布时间】:2019-04-14 17:29:06
【问题描述】:
当我在一个包中使用一个函数时,我通常可以将它写成function() 或不带括号的function。 scales::comma 似乎不是这种情况。为什么下面的第 7 行可以工作,而第 8 行却不行。
library(tidyverse)
mtcars %>%
count(cyl) %>%
ungroup() %>%
mutate(n = n * 1000) %>%
ggplot(aes(cyl, n)) +
scale_y_continuous(labels = scales::comma) + # line 7
# scale_y_continuous(labels = scales::comma()) + # line 8
geom_line()
第 8 行错误
Error in number(x = x, accuracy = accuracy, scale = scale, prefix = prefix, :
argument "x" is missing, with no default
【问题讨论】: