找回密码
 注册
查看: 5724|回复: 0

R语言:install.packages()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-2-16 19:13:44 | 显示全部楼层 |阅读模式
install.packages(utils)
install.packages()所属R语言包:utils

                                        Install Packages from Repositories or Local Files
                                         从资料库或本地文件安装软件包

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

Download and install packages from CRAN-like repositories or from local files.
从CRAN的类似资料库或从本地文件下载并安装软件包。


用法----------Usage----------


install.packages(pkgs, lib, repos = getOption("repos"),
                 contriburl = contrib.url(repos, type),
                 method, available = NULL, destdir = NULL,
                 dependencies = NA, type = getOption("pkgType"),
                 configure.args = getOption("configure.args"),
                 configure.vars = getOption("configure.vars"),
                 clean = FALSE, Ncpus = getOption("Ncpus", 1L),
                 libs_only = FALSE, INSTALL_opts, ...)



参数----------Arguments----------

参数:pkgs
character vector of the names of packages whose current versions should be downloaded from the repositories.  If repos = NULL, a character vector of file paths of ".zip" files containing binary builds of packages. Source directories or ".tar.gz" archives may also be installed, but some packages need suitable tools installed (see the "Details" section).  If this is missing or a zero-length character vector, a listbox of available packages is presented where possible in an interactive R session.  
其当前版本的软件包名称的字符向量应当从资料库下载。如果repos = NULL,一个文件路径的特征向量.zip文件包含二进制软件包构建。源目录或.tar.gz档案也可能被安装,但有些软件包需要安装合适的工具(见“详细资料”部分)。如果这是丢失或零长度的字符向量,可用包的列表框在可能的情况下互动R会话。


参数:lib
character vector giving the library directories where to install the packages.  Recycled as needed.  If missing, defaults to the first element of .libPaths().  
特征向量库目录安装软件包。回收作为需要。如果缺少,默认为.libPaths()的第一个元素。


参数:repos
character vector, the base URLs of the repositories to use, e.g., the URL of a CRAN mirror such as "http://cran.us.r-project.org".  Can be NULL to install from local files (with extension ".tar.gz" for source packages).  
特征向量,基地使用的资料库的网址,例如,CRAN的镜子,如"http://cran.us.r-project.org"的URL。可以NULL安装从本地文件(扩展.tar.gz源代码包)。


参数:contriburl
URL(s) of the contrib sections of the repositories.  Use this argument only if your repository mirror is incomplete, e.g., because you burned only the "contrib" section on a CD.  Overrides argument repos.  As with repos, can also be NULL to install from local files.  
URL(S)仓库的contrib部分。使用此参数,只有当你的资料库镜像是不完整的,例如,因为你烧在CD上只有contrib节。覆盖参数repos。至于repos,也可以是NULL从本地文件安装。


参数:method
download method, see download.file.  
下载方法,请参阅download.file。


参数:available
an object as returned by available.packages listing packages available at the repositories, or NULL when the function makes an internal call to available.packages.  
作为一个对象返回available.packages上市包仓库,或NULL功能,使内部通话available.packages。


参数:destdir
directory where downloaded packages are stored.  If it is NULL (the default) a subdirectory downloaded_packages of the session temporary directory will be used (and the files will be deleted at the end of the session).   
存储下载的软件包目录。如果是的话NULL(默认)的子目录downloaded_packages将用于会议临时目录(和删除的文件将在会议结束时)。


参数:dependencies
logical indicating to also install uninstalled packages which these packages depend on/link to/import/suggest (and so on recursively).  Not used if repos = NULL. Can also be a character vector, a subset of c("Depends", "Imports", "LinkingTo", "Suggests", "Enhances").  Only supported if lib is of length one (or missing), so it is unambiguous where to install the dependent packages.  The default, NA, means c("Depends", "Imports", "LinkingTo") if lib is unambiguous, and FALSE otherwise.  
逻辑表示还安装卸载的软件包,这些软件包依赖/链接到/进口/建议(和等递归)。如果repos = NULL不使用。也可以是一个特征向量,c("Depends", "Imports", "LinkingTo", "Suggests", "Enhances")子集。只支持lib是一个长度(或失踪),所以它是明确的依赖包的安装位置。默认情况下,NA,意味着c("Depends", "Imports", "LinkingTo")如果lib是明确的,FALSE否则。


参数:type
character, indicating the type of package to download and install.  Possible values are "source", "mac.binary.leopard" and "win.binary": the binary types can be listed and downloaded but not installed on other platforms.  The default is the appropriate binary type on Windows and on the CRAN binary Mac OS X distribution, otherwise "source".  
字符,表明包的类型,下载并安装。可能的值是"source","mac.binary.leopard"和"win.binary":二进制类型,可以上市和下载,而不是在其他平台上安装。默认情况下是适当的二进制类型在Windows和CRAN的二进制Mac OS X的分布上,否则"source"。


参数:configure.args
(not used on Windows) a character vector or a named list.  If a character vector with no names is supplied, the elements are concatenated into a single string (separated by a space) and used as the value for the --configure-args flag in the call to R CMD INSTALL.  If the character vector has names these are assumed to identify values for --configure-args for individual packages.  This allows one to specify settings for an entire collection of packages which will be used if any of those packages are to be installed.  (These settings can therefore be re-used and act as default settings.)  A named list can be used also to the same effect, and that allows multi-element character strings for each package which are concatenated to a single string to be used as the value for --configure-args.  
(不用于Windows)字符向量或命名列表。如果提供一个没有名字的字符向量,元素连接成一个字符串(以空格分隔)和使用的--configure-args调用R CMD INSTALL在标志的价值。如果特征向量的名称,这些假设--configure-args个别套件的识别值。这允许指定为整个集合将用于如果任何这些包要安装的软件包的设置。 (这些设置,因此可以被重新使用,并作为默认设置。)命名名单,也可用于同样的效果,并允许被连接到一个单一的字符串被用来作为每个包的多元素的字符串--configure-args值。


参数:configure.vars
(not used on Windows) analogous to configure.args for flag --configure-vars, which is used to set environment variables for the configure run.   
(不用于Windows),类似于configure.args旗--configure-vars,它是用来设置configure运行的环境变量。


参数:clean
a logical value indicating whether to specify to add the --clean flag to the call to R CMD INSTALL. This is sometimes used to perform additional operations at the end of the package installation in addition to removing intermediate files.  
一个逻辑值,该值指示是否指定要添加调用--cleanR CMD INSTALL标志。这有时被用来执行额外的操作,除了删除中间文件包安装结束。


参数:Ncpus
The number of parallel processes to use for a parallel install of more than one source package.  Values greater than one are supported if the make command specified by Sys.getenv("MAKE", "make") accepts argument -k -j     <VAR>Ncpus</VAR>.  
并行进程使用一个并行安装多个源码包。如果make命令Sys.getenv("MAKE", "make")指定接受参数-k -j     <VAR>Ncpus</VAR>值大于一的支持。


参数:libs_only
a logical value: should the --libs-only option be used to install only additional sub-architectures?  (See also INSTALL_opts.)  This can also be used on Windows to install just the DLL(s) from a binary package, e.g. to add 64-bit DLLs to a 32-bit install.   
一个逻辑值:--libs-only选项应该只安装额外的子架构? (又见INSTALL_opts)。这也可以在Windows上使用二进制包安装的DLL(S),例如:添加32位安装64位的DLL。


参数:INSTALL_opts
an optional character vector of additional option(s) to be passed to R CMD INSTALL for a source package install.  E.g. c("--html", "--no-multiarch").  
一个额外的选项可选的特征向量(S)被传递到R CMD INSTALL源包安装。例如c("--html", "--no-multiarch")。


参数:...
Arguments to be passed to download.file, or to the functions for binary installs on Mac OS X and Windows (which accept an argument "lock": the the section on "Locking").  
参数被传递到download.file,或在Mac OS X和Windows的二进制安装功能(接受一个参数"lock":“锁定”一节)。


Details

详情----------Details----------

R packages are primarily distributed as source packages, but binary packages (a packaging up of the installed package) are also available, and the type most commonly used on Windows and from the CRAN distribution for Mac OS X.  This function can install either type where supported, either by downloading a file from a repository or from a local file.  The default type is given by getOption("pkgType"): this is "source" apart from under Windows or a CRAN binary distribution for Mac OS X.
R包主要分布源码包,但也可用二进制包(包装起来的安装包),此功能在Windows和CRAN的分布为Mac OS X中使用最普遍的类型,可以安装两种类型支持,无论是从仓库或从本地文件下载文件。 getOption("pkgType"):这是默认类型"source"除了在Windows或Mac OS X的CRAN的二进制分布

This is the main function to install packages. It takes a vector of names and a destination library, downloads the packages from the repositories and installs them.  (If the library is omitted it defaults to the first directory in .libPaths(), with a message if there is more than one.)  If lib is omitted or is of length one and is not a (group) writable directory, the code offers to create a personal library tree (the first element of Sys.getenv("R_LIBS_USER")) and install there. Detection of a writable directory is problematic on Windows: see the "Note" section.
这是安装软件包的主要功能。它需要一个向量的名称和目标库,从仓库下载软件包并安装它们。 (如果库被省略,默认的第一个目录.libPaths()消息,如果有多个)。如果lib省略或长度为一,是不是一个(组)可写的目录,代码提供了创建一个个人图书馆树(Sys.getenv("R_LIBS_USER")的第一个元素),并安装有。检测一个可写目录是Windows上的问题:见“注”部分。

For source packages from a repository an attempt is made to install the packages in an order that respects their dependencies. This does assume that all the entries in lib are on the default library path for installs (set by R_LIBS).
对于企图从档案库的源代码包安装包秩序,尊重它们的依赖。这不承担所有的lib项上安装的默认库路径(R_LIBS设置)。

Using packages with type = "source" always works on Windows provided the package contains no C/C++/Fortran code that needs compilation.  Otherwise you will need to have installed the Rtools collection as described in the "R for Windows FAQ" and you must have the PATH environment variable set up as required by Rtools.
使用type = "source"总是在Windows工作提供包包包含没有C / C + + / Fortran语言需要编译的代码。否则,你将需要已经安装Rtools收集中所述的“R为Windows常见问题,你必须有PATH环境变量设置Rtools需要。

When installing a binary package, install.packages will abort the install if it detects that the package is already installed and is currently in use.  In some circumstances (e.g. multiple instances of R running at the same time and sharing a library) it will not detect a problem, but the installation may fail.
当安装的二进制包,install.packages将中止安装,如果它检测到该软件包已安装,是目前使用。在某些情况下(如研发的多个实例同时运行和共享库),它不会发现问题,但安装可能会失败。

You are advised to run update.packages before install.packages to ensure that any already installed dependencies have their latest versions.
建议你运行update.packages前install.packages,以确保任何已安装的依赖关系,其最新版本。

Argument libs_only = TRUE is supported for source installs and for Windows binary installs.
参数libs_only = TRUE源安装和Windows二进制安装支持。


值----------Value----------

Invisible NULL.
无形的NULL。


锁定----------Locking----------

There are various options for locking: these differ between source and binary installs.
有锁的各种选项:这些源代码和二进制安装之间的差异。

By default for a source install, the library directory is "locked" by creating a directory "00LOCK" within it.  This has two purposes: it prevents any other process installing into that library concurrently, and is used to store any previous version of the package to restore on error.  A finer-grained locking is provided by the option --pkglock which creates a separate lock for each package: this allows enough freedom for parallel installation.  Per-package locking is the default when installing a single package, and for multiple packages when Ncpus > 1L. Finally locking (and restoration on error) can be suppressed by --no-lock.
源安装中,默认情况下,图书馆的目录是锁定创建目录00LOCK在它。这有两个目的:它阻止任何其他进程,同时安装该库,用于存储任何包错误恢复以前的版本。提供一个细粒度的锁定选项--pkglock为每个包创建一个单独的锁:这允许自由足够的并行安装。每包锁是默认安装一个单一的软件包时,多个包时Ncpus > 1L。最后锁定(错误恢复),可以抑制由--no-lock。

For a Mac OS X or Windows binary install, no locking is done by default.  Setting argument lock to TRUE (it defaults to the value of getOption("install.lock", FALSE)) will use per-directory locking as described for source installs: if the value is "pkglock" per-package locking will be used.
对于Mac OS X或Windows二进制安装,没有锁定默认情况下完成。设置参数lockTRUE(默认为值getOption("install.lock", FALSE))将使用每个目录锁定为源安装描述:如果该值是"pkglock"每包将用于锁定。

If package locking is used on Windows with libs_only = TRUE and the installation fails, the package will be restored to its previous state.
libs_only = TRUE如果包锁是用来在Windows安装失败,将恢复到以前的状态包。

Note that it is possible for the package installation to fail so badly that the lock directory is not removed: this inhibits any further installs to the library directory (or for --pkglock, of the package) until the lock directory is removed manually.
请注意,它有可能包安装失败如此糟糕,锁目录不会被删除:这个禁止任何进一步的安装库目录(或--pkglock,包),直到锁目录手动删除。


注意----------Note----------

install.packages tries to detect if you have write permission on the library directories specified, but Windows reports unreliably. If there is only one library directory (the default), R tries to find out by creating a test directory, but even this need not be the whole story.  Under Windows Vista and later you may have permission to write in a library directory but lack permission to write binary files (such as ".dll" files) there.  See the "R for Windows FAQ" for workarounds.
install.packages尝试检测如果你已经写在指定的目录库的权限,但Windows报告不可靠。如果是只有一个库目录(默认),研究,试图找到通过创建一个测试目录,但即便如此,不必是整个故事。在Windows Vista和以后,你可能有权限写在图书馆的目录,但缺乏权限,有写的二进制文件(如.dll文件)。请参阅变通办法“R”为Windows常见问题。


参见----------See Also----------

update.packages, available.packages, download.packages, installed.packages, contrib.url.
update.packages,available.packages,download.packages,installed.packages,contrib.url。

See download.file for how to handle proxies and other options to monitor file transfers.
看到download.file如何处理代理和其他选项来监视文件传输。

INSTALL, REMOVE, remove.packages, library, .packages, read.dcf
INSTALL,REMOVE,remove.packages,library,.packages,read.dcf

The "R Installation and Administration" manual for how to  set up a repository.
“R安装和管理的手册为如何建立一个仓库。


举例----------Examples----------



## Not run: [#无法运行:]
install.packages(
    c("XML_0.99-5.tar.gz",
      "../../Interfaces/Perl/RSPerl_0.8-0.tar.gz"),
    repos = NULL,
    configure.args = c(XML = '--with-xml-config=xml-config',
                       RSPerl = "--with-modules='IO Fcntl'"))

## End(Not run)[#结束(不运行)]

转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2025-1-24 09:24 , Processed in 0.020702 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表