我正在尝试从 GitHub 安装软件包:https://github.com/NIB-SI/seekr
但是,跑步
devtools::install_github("ablejec/seekr")
产生以下错误
Downloading GitHub repo NIB-SI/pisar@HEAD Error: Failed to install 'pisar' from GitHub: input string 34 is invalid In addition: Warning message: In gsub("[^/]", "", file_list) : unable to translate 'NIB-SI-pisar-33d70bb/devel/_Welcome -<c0> R packages.URL' to a wide string
具有相同设置(在 Windows 上运行的 RStudio)的其他人能够安装此软件包,但我偷偷怀疑该错误与 UTF-8 相关。我可以通过下载的包加载包,如下所示:
library("seekr", lib.loc = "C:/localfolder/seekr")
我已在 GitHub 存储库中提交了此问题,但我感觉这是一个非常具体的错误,在不久的将来可能无法修复。
作为参考,我的 SessionInfo 输出是:
R version 4.3.0 (2023-04-21 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19044) Matrix products: default locale: [1] C time zone: Europe/Paris tzcode source: internal attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] seekr_0.1.0.9000 lubridate_1.9.2 forcats_1.0.0 stringr_1.5.0 dplyr_1.1.2 purrr_1.0.1 readr_2.1.4 tidyr_1.3.0 [9] tibble_3.2.1 ggplot2_3.4.2 tidyverse_2.0.0 jsonlite_1.8.5 loaded via a namespace (and not attached): [1] generics_0.1.3 utf8_1.2.3 stringi_1.7.12 hms_1.1.3 digest_0.6.31 magrittr_2.0.3 timechange_0.2.0 [8] grid_4.3.0 pkgload_1.3.2 fastmap_1.1.1 processx_3.8.1 pkgbuild_1.4.2 sessioninfo_1.2.2 urlchecker_1.0.1 [15] ps_1.7.5 promises_1.2.0.1 fansi_1.0.4 scales_1.2.1 cli_3.6.1 shiny_1.7.4 rlang_1.1.1 [22] crayon_1.5.2 ellipsis_0.3.2 munsell_0.5.0 withr_2.5.0 remotes_2.4.2 cachem_1.0.8 devtools_2.4.5 [29] tools_4.3.0 tzdb_0.4.0 memoise_2.0.1 colorspace_2.1-0 httpuv_1.6.11 curl_5.0.1 vctrs_0.6.2 [36] R6_2.5.1 mime_0.12 lifecycle_1.0.3 fs_1.6.2 htmlwidgets_1.6.2 usethis_2.2.0 miniUI_0.1.1.1 [43] pkgconfig_2.0.3 callr_3.7.3 pillar_1.9.0 later_1.3.1 gtable_0.3.3 glue_1.6.2 profvis_0.3.8 [50] Rcpp_1.0.10 tidyselect_1.2.0 rstudioapi_0.14 xtable_1.8-4 htmltools_0.5.5 compiler_4.3.0 prettyunits_1.1.1
存储库中有一些非 UTF8 字符:我分叉了存储库并删除了它们。如果您从 jpmam1/pisar 安装 pisar,而不是 NIB-SI/pisar,即
devtools::install_github("jpmam1/pisar")
然后,重新安装导引头:
devtools::install_github("ablejec/seekr")
它应该可以毫无问题地安装(如果它解决了您的问题,我将向 NIB-SI/pisar 存储库提出拉取请求)。
知道为什么原始编码不起作用吗?
English_United States.1252
区域设置使用Windows-1252编码,这是拉丁字母的字符编码。该字符编码是 ISO 8859-1 的超集,并且是许多 Windows 应用程序中的默认编码,因此它被设计为与许多旧软件包兼容。
当您将语言环境切换到
English_United States.1252
时,您正在更改 R 处理和解释字符串的方式。有些包在设计时可能考虑到了这种编码,或者它们可能包含非 UTF-8 字符,当 R 尝试将它们解释为 UTF-8 时,这些字符会导致问题。切换到此区域设置有助于解决您的问题这一事实表明,
seekr
包(或可能是其依赖项之一)包含此类非 UTF-8 字符。
Bioconductor/BiocManager
,seekr
的依赖项通常与LC_COLLATE=English_United States.1252
一起使用,如issue 103所示。