[英]Docker install.packages R on Ubuntu 22.04 packages not found
我有 docker 命令來安裝 R 包:
RUN R -e "install.packages(c("readxl","zoo","plotly","RcppRoll","shiny","tidyverse"\
,"shinyWidgets","shinythemes","metR","writexl","shinydashboard","lubridate","sjmisc"\
,"DBI","dplyr","dbplyr","odbc"), repos='https://cloud.r-project.org/')"
我得到錯誤
install.packages(c(readxl,zoo,plotly,RcppRoll,shiny,tidyverse,shinyWidgets,shinythemes,metR,writexl,shinydashboard,lubridate,sjmisc,DBI,dplyr,dbplyr,odbc),repos='https://cloud. r-project.org/') install.packages(c(readxl, zoo, plotly, RcppRoll, shiny, tidyverse, : object 'readxl' not found Execution halted 錯誤
錯誤在哪里? R 在沒有 docker 的情況下運行良好。
您正在成為 shell 引用的受害者,有時稱為 shell 引用地獄。 事實上,正如你所說,“R 在沒有 docker 的情況下運行良好”只是意味着你在 R 中有正確的命令,但不是來自 shell。見證
$ Rscript -e "cat("Hello, world\n")"
Error: unexpected end of input
Execution halted
$
但是(方法 1)escaping 引用有效:
$ Rscript -e "cat(\"Hello, world\n\")"
Hello, world
$
或(方法 2)用單引號將雙引號括起來
$ Rscript -e 'cat("Hello, world\n")'
Hello, world
$
所以我會嘗試
RUN R -e 'install.packages(c("readxl","zoo","plotly","RcppRoll","shiny",
"tidyverse", "shinyWidgets","shinythemes","metR","writexl",
"shinydashboard","lubridate","sjmisc", "DBI", "dplyr",
"dbplyr", "odbc"), repos="https://cloud.r-project.org/")'
另外,您可能還想查看r2u以在 Ubuntu 22.04 或 20.04 上將所有這些作為二進制文件 (..) 完成。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.