大佬教程收集整理的这篇文章主要介绍了代码块内的 ggplot 错误,但不在控制台中:gzfile(file, "wb") 中的警告:无法打开压缩文件?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
好吧,伙计们,我被难住了。
我在 Rstudio 项目中有一个 .Rmd 文件。在其中一个代码块中,我使用 dplyr 函数来汇总数据框,然后使用 ggplot2 绘制汇总数据的直方图。当我运行 ggplot 代码时,我收到了这个非常难看的错误信息:
Warning in gzfile(file,"wb") :
cAnnot open compressed file '/Users/ebar/DropBox/R/NoCoWildDataProcessing/.Rproj.user/shared/notebooks/53CC2A92-Explain-Flattenning-data /1/4FF2C393C9CC962A/cmine11fvbhpf_t/fac421ffa1b249f19ac853590bff56e8.snapshot',probable reason 'No such file or directory'
Error in gzfile(file,"wb") : cAnnot open the connection
Error in (function (which = dev.cur()) :
QuartzBitmap_Output - unable to open file '/Users/ebar/DropBox/R/NoCoWildDataProcessing/.Rproj.user/shared/notebooks/53CC2A92-Explain-Flattenning-data /1/4FF2C393C9CC962A/cmine11fvbhpf_t/_rs_chunk_plot_001.png'
.Rmd
中的代码块仅包括以下内容:
data_sumMary<-data %>% group_by(subject_ids) %>% summarise(
NumClassifications = length(unique(classification_ID))
)
ggplot(data_sumMary,aes(NumClassifications))+
geom_histogram()
当我将 ggplot 代码复制到控制台并在那里运行时,直方图在绘图窗口中显示得很好,我没有收到任何错误消息。我真的很希望能够将其全部包含在代码块中。我在许多其他情况下都这样做过,但从未遇到过这个问题。
我已经尝试了以下步骤,看看它们是否有帮助:
没有任何帮助。
该项目位于 DropBox 文件夹中,它不是共享项目。我在 DropBox 上有几十个其他 R 项目,但从未见过这个问题。我的本地磁盘也有足够的空间。
以下是一些示例数据(当我使用这些示例数据以及完整数据集时出现错误):
tibble::tribble(
~subject_ids,~NumClassifications,52256341L,1L,52256564L,52256696L,52259301L,52259303L,1L
)
这里是 sessionInfo
sessionInfo()
#> R version 4.0.5 (2021-03-31)
#> Platform: x86_64-apple-darwin17.0 (64-bit)
#> Running under: macOS Catalina 10.15.7
#>
#> Matrix products: default
#> BLAS: /library/Frameworks/R.framework/Versions/4.0/resources/lib/libRblas.dylib
#> LAPACK: /library/Frameworks/R.framework/Versions/4.0/resources/lib/libRlapack.dylib
#>
#> locale:
#> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
#>
#> attached base packages:
#> [1] stats graphics Grdevices utils datasets methods base
#>
#> loaded via a namespace (and not attached):
#> [1] knitr_1.33 magrittr_2.0.1 rlang_0.4.11 fansi_0.4.2
#> [5] Stringr_1.4.0 styler_1.4.1 highr_0.9 tools_4.0.5
#> [9] xfun_0.22 utf8_1.2.1 withr_2.4.2 HTMLtools_0.5.1.1
#> [13] ellipsis_0.3.2 yaml_2.2.1 digest_0.6.27 tibble_3.1.1
#> [17] lifecycle_1.0.0 Crayon_1.4.1 purrr_0.3.4 vctrs_0.3.8
#> [21] fs_1.5.0 glue_1.4.2 evaluate_0.14 rmarkdown_2.7
#> [25] reprex_2.0.0 Stringi_1.5.3 compiler_4.0.5 pillar_1.6.0
#> [29] BACkports_1.2.1 pkgconfig_2.0.3
我将不胜感激任何指点!
@H_618_0@解决方法所以问题是我的 .Rmd
文件的名称中有一个我没有看到的意外空格(空格就在 .
之前。这个故事的寓意:多关注你的代码会更好,很幸运有这么一群愿意互相帮助的人!
以上是大佬教程为你收集整理的代码块内的 ggplot 错误,但不在控制台中:gzfile(file, "wb") 中的警告:无法打开压缩文件?全部内容,希望文章能够帮你解决代码块内的 ggplot 错误,但不在控制台中:gzfile(file, "wb") 中的警告:无法打开压缩文件?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。