numeric_version(base)
numeric_version()所属R语言包:base
Numeric Versions
数字版本
译者:生物统计家园网 机器人LoveR
描述----------Description----------
A simple S3 class for representing numeric versions
一个简单的S3类为代表的数字版本
用法----------Usage----------
numeric_version(x, strict = TRUE)
package_version(x, strict = TRUE)
R_system_version(x, strict = TRUE)
getRversion()
参数----------Arguments----------
参数:x
a character vector with suitable numeric version strings (see "Details"); for package_version, alternatively an R version object as obtained by R.version.
package_version,或者R版本对象R.version获得一个合适的数字版本字符串的字符向量(见“详细资料”);
参数:strict
a logical indicating whether invalid numeric versions should results in an error (default) or not.
逻辑表明是否无效的数字版本应该在一个错误的结果(默认),或不。
Details
详情----------Details----------
Numeric versions are sequences of one or more non-negative integers, usually (e.g., in package "DESCRIPTION" files) represented as character strings with the elements of the sequence concatenated and separated by single . or - characters. R package versions consist of at least two such integers, an R system version of exactly three (major, minor and patchlevel).
数字版本的一个或多个非负整数,通常表示为字符串串联序列中的元素和单DESCRIPTION分隔(例如,在包.文件)序列或-字符。 R包版本包括至少有两个这样的整数,整整三(主要,次要和PATCHLEVEL)R系统版本。
Functions numeric_version, package_version and R_system_version create a representation from such strings (if suitable) which allows for coercion and testing, combination, comparison, summaries (min/max), inclusion in data frames, subscripting, and printing. The classes can hold a vector of such representations.
功能numeric_version,package_version和R_system_version创建一个这样的字符串表示(如适用)允许胁迫和测试,组合,比较,总结(最小/最大),列入数据框,下标,并打印。类可容纳的申述向量。
getRversion returns the version of the running R as an R system version object.
getRversion返回的运行R R系统版本对象的版本。
The [[ operator extracts or replaces a single version. To access the integers of a version use two indices: see the examples.
[[算子提取物或取代了单一版本。要访问一个版本使用两个指数的整数:看到的例子。
参见----------See Also----------
compareVersion
compareVersion
举例----------Examples----------
x <- package_version(c("1.2-4", "1.2-3", "2.1"))
x < "1.4-2.3"
c(min(x), max(x))
x[2, 2]
x$major
x$minor
if(getRversion() <= "2.5.0") { ## work around missing feature[#解决失踪功能]
cat("Your version of R, ", as.character(getRversion()),
", is outdated.\n",
"Now trying to work around that ...\n", sep = "")
}
x[[c(1,3)]] # '4' as a numeric vector, same as x[1, 3][4作为一个数值向量,x相同[1]]
x[1, 3] # 4 as an integer[作为一个整数]
x[[2, 3]] <- 0 # zero the patchlevel[零PATCHLEVEL]
x[[c(2,3)]] <- 0 # same[同]
x
x[[3]] <- "2.2.3"; x
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|