我已经在 Windows 10 机器上设置了全新的 R 安装,并且无法运行像以下这样简单的东西:
data.frame(a = rnorm(100), b = rnorm(100)) |> 
  ggplot(aes(a, b)) +
  ggsave("temp.png")
因为我收到以下错误:
Error: Can't add `ggsave("temp.png")` to a ggplot object.
我的会话信息是:
R version 4.1.0 (2021-05-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=Catalan_Spain.1252  LC_CTYPE=Catalan_Spain.1252    LC_MONETARY=Catalan_Spain.1252 LC_NUMERIC=C                  
[5] LC_TIME=Catalan_Spain.1252    
attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     
other attached packages:
[1] ggplot2_3.3.4 dplyr_1.0.6  
loaded via a namespace (and not attached):
 [1] magrittr_2.0.1    tidyselect_1.1.1 …