renv包是一个cli工具,用于为r统计编程语言创建环境。它利用了python venv模块及其模块化envbuilder类。

renv的Python项目详细描述


PyPI versionBuild Status

雷诺数(β)

为R创建虚拟环境(目前仅限Linux实现)

说明

使用R进行数据分析的一个问题是依赖性问题,特别是 科学家使用多个版本的R或R包,并有大量 他们正在与R一起开发的项目。依赖性问题在这些个人或团体中特别普遍 正在开发R包。renv是一个Python style 虚拟环境管理器,用于为R创建虚拟环境。

安装

这个包是用^{}管理的,也可以在pypi上使用。

pip install renv

用法

renv目前处于beta版本,并且只在linux中受支持,因此如果您的r 以默认方式以外的方式安装可能有很多 不可预见的错误、拼写错误和代码可能是 更有效率。请提交issue 或者PR。我们很想得到 社区反馈。

Rprofile还提示您安装一些常用的 包装。它的功能是有用的,但将为 此包的实际发布。

命令

安装了renv之后,需要初始化renv以在$HOME目录中设置.beRi/.renv文件夹:

renv init

现在,您可以轻松地创建一个环境:

renv -e myenv -r /path/to/R/folder # Find your current R folder is using `which R` on Linux.

名为myenv的环境文件夹将在$HOME/.beRi/.renv中创建。

激活环境:

cd $HOME/.beRi/.renv/myenv/bin
. ./activate 

要停用R环境:

deactivate

使用--help查看其他命令行选项。

user@host:~$ renv --help
Usage: renv [OPTIONS] COMMAND [ARGS]...Options:  -r, --r_home TEXT               Provide the root of the directory tree where                                  R is installed ($R_HOME).  This would be R's                                  installation directory when using                                  ./configure --prefix=<r_home>.  [required]  -e, --env_name TEXT             Name of the environment.  [required]  -p, --path TEXT                 An absolute installation path for renv.                                  [default: ~/.beRi]  -n, --name TEXT                 A directory name for renv.  [default: .renv]  -b, --bindir TEXT               Provide the bin directory if R was installed                                  when using ./configure --bindir=<binpath>.  -l, --libdir TEXT               Provide the lib directory if R was installed                                  when using ./configure --libdir=<libpath>.  -i, --includedir TEXT           Provide the include directory if R was                                  installed when using ./configure                                  --includedir=<includepath>.  -rp, --recommended_packages BOOLEAN                                  This determines wheather or not the                                  recommended packages are installed in theR                                  environment along with the base packages.                                  In most cases it's best to keep thedefault                                  value.  --clear BOOLEAN                 Deletes the contents of the environment                                  directory if it already exists, before                                  environment creation.  -u, --upgrade BOOLEAN           Upgrades the environment directory to use                                  this version of R.  -p, --prompt TEXT               Provide an alternative prompt prefix for                                  this environment.  -v, --verbose                   Show verbose cli output.  --help                          Show this message and exit.Commands:  init  Initialize renv using the <path>/<name>.                         Show this message and exit.

创建R环境

user@host:~$ renv  -e ~/projects/rna-brain -r /usr/local/apps/R/R-3.4.4/
user@host:~$source ~/projects/rna-brain/bin/activate
(rna-brain) user@host:~$ RR version x.y.z (YYY-MM-DD) -- "Dist"Copyright (C) YYY The R Foundation for Statistical ComputingPlatform: Renv is working for some linux distrubutionsR is free software and comes with ABSOLUTELY NO WARRANTY.You are welcome to redistribute it under certain conditions.Type 'license()' or 'licence()' for distribution details.R is a collaborative project with many contributors.Type 'contributors()' for more information and'citation()' on how to cite R or R packages in publications.Type 'demo()' for some demos, 'help()' for on-line help, or'help.start()' for an HTML browser interface to help.Type 'q()' to quit R...................Attempting to Load Bioconductor...................Warning: Prompting for Bioconductor Installation...Do you want to install Bioconductor??? [Y/N]n..................Attempting to Load Devtools...................Warning: Prompting for Devtools Installation...Do you want to install Devtools??? [Y/N]n..................Attempting to Load Tidyverse...................Warning: Prompting for Tidyverse Installation...Do you want to install Tidyverse??? [Y/N]nWarning messages:1: In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :  there is no package called ‘BiocInstaller’2: In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :  there is no package called ‘devtools’3: In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :  there is no package called ‘tidyverse’>

功能

  1. 使用默认配置设置创建默认r虚拟环境 或预先存在的环境目录中的YAML文件。
  2. 管理用户和环境的.rprofile和.renviron 文件

下面是YAML配置文件的示例(可能有错误或 钥匙丢失)。尝试使用绝对路径。

R_ABS_HOME:"/home/grabear/R-installs/R-3.4.3/lib64/R"R_ENV_HOME:"/home/grabear/rna-brain"R_LIBS_USER:"/home/grabear/rna-brain/lib64/R/library"R_INCLUDE_DIR:"/home/grabear/rna-brain/lib64/R/include"R_VERSION:"3.4.3"# LIST OF DEFAULT variables for .RprofileCRAN_MIRROR:"https://cran.rstudio.com/"CRANEXTRA_MIRROR:"https://mirrors.nics.utk.edu/cran/"# Determine how to format this for .RprofileSTANDARD_PKG_LIST:BiocInstaller:"Bioconductor"devtools:"Devtools"tidyverse:"Tidyverse"REPRODUCIBLE_WORKFLOW_PKG_LIST:packrat:"Packrat"miniCRAN:"MiniCRAN"

有问题吗???

为什么是雷恩?

使用r创建可复制工作流的工具对于 长时间。雷恩的灵感来自 packrat,它允许您 创建独立的包库,以及python的 venv模块,它 使用自己的包库python创建环境 二进制文件。因此,renv帮助用户更好地管理系统 通过为 具有自己的r二进制文件(r和rscript)的r的特定版本 以及他们自己独立的包库

为什么点击和诗歌?

为了加快开发速度,在argparse上使用click。它需要一个 额外的依赖性,但它很容易使用和我们所知道的使用诗歌 出于类似的原因。这是一个发展中的项目,所以我们可能会后悔 后来,它被证明是一个非常有用的工具。

为什么不开发R中的所有内容?

再说一次,我们将继续我们所知道的。我们并不陌生 用R编程或制作包,但我们在 开发和维护python代码。虚拟环境已经 广泛用于python语言,这意味着我们不必 重新创建.whl

维护人员

罗伯·吉尔摩{a9}{a10}
桑蒂娜林{a11}{a12}
夏丽塔哈钦斯{a13}{a14}

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
并行处理java。util。同时发生的叉子在游泳池里。常见的并行性准则,用于选择正确的并行度大小   java如何将空白字符追加到指定长度?   安卓应用程序中出现错误,SSLHandshakeException,找不到证书路径的信任锚点   java如何使用JUnit Mockito验证检查方法是否未被调用   java如何使用不同的@RequestMapping解析多个控制器中的静态页面   Selenium中的javascript需要验证搜索结果   访问数据库SQLiteopenHelper方法时java应用程序崩溃(nullpointerexception)   在二叉树中验证最小堆时出现java空指针异常   Java 7的SSL连接失败   java用RestEasyWebTarget替换ProxyFactory不起作用   在Java应用程序中单击“否”按钮后,数组程序冻结(无响应)   数组中的前缀Java初学者前进和   Java HTML解析器,包括脚本标记和LineNumberReader   在java中为长类型数字加前导零   正则表达式无法映射正则表达式java。lang.IllegalArgumentException:模式段中捕获组的数量