strutils(IRanges)
strutils()所属R语言包:IRanges
Low-level string utilities
低级别的字符串公用事业
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Some low-level string utilities that operate on ordinary character vectors. For more advanced string manipulations, see the Biostrings package.
一些低级别的字符串实用工具,对普通字符向量操作。对于更高级的字符串操作,看到Biostrings包。
用法----------Usage----------
strsplitAsListOfIntegerVectors(x, sep=",")
参数----------Arguments----------
参数:x
A character vector where each element is a string containing comma-separated decimal integer values.
一个特征向量,其中每个元素是一个字符串,其中包含逗号分隔的十进制整数值。
参数:sep
The value separator character.
值分隔符。
值----------Value----------
A list of integer vectors. The list is of the same length as the input.
整数向量列表。这份名单是相同的长度作为输入。
注意----------Note----------
strsplitAsListOfIntegerVectors is similar to the strsplitAsListOfIntegerVectors2 function shown in the Examples section below, except that the former generally raises an error where the latter would have inserted an NA in the returned object. More precisely:
strsplitAsListOfIntegerVectors是strsplitAsListOfIntegerVectors2函数下面的示例“部分中除前提出了一个错误,而后者将插入NA在返回的对象,类似。更确切地说:
The latter accepts NAs in the input, the former doesn't (raises an error).
后者接受输入的NAS,前不(引发错误)。
The latter introduces NAs by coercion (with a warning), the former doesn't (raises an error).
后者介绍了强制NAS(警告),前者没有(提出了一个错误)。
The latter supports "inaccurate integer conversion in coercion" when the value to coerce is > INT_MAX (then it's coerced to INT_MAX), the former doesn't (raises an error).
后者支持“在强制不准确的整数转换”> INT_MAX(那么它裹挟到INT_MAX),前者不强迫当值是(引发错误)。
The latter coerces non-integer values (e.g. 10.3) to an int by truncating them, the former doesn't (raises an error).
后者胁迫截断他们为int的非整数值(如10.3),前者不引发错误。
When it fails, strsplitAsListOfIntegerVectors will print an informative error message. Finally, strsplitAsListOfIntegerVectors is faster and uses much less memory than strsplitAsListOfIntegerVectors2.
当它失败时,strsplitAsListOfIntegerVectors将打印信息的错误消息。最后,strsplitAsListOfIntegerVectors是速度更快,使用较少的内存比strsplitAsListOfIntegerVectors2。
作者(S)----------Author(s)----------
H. Pages
参见----------See Also----------
strsplit
strsplit
举例----------Examples----------
x <- c("1116,0,-19",
" +55291 , 2476,",
"19184,4269,5659,6470,6721,7469,14601",
"7778889, 426900, -4833,5659,6470,6721,7096",
"19184 , -99999")
y <- strsplitAsListOfIntegerVectors(x)
y
## In normal situations (i.e. when the input is well-formed),[#在正常情况下(即当输入是良好的),]
## strsplitAsListOfIntegerVectors() does actually the same as the[#strsplitAsListOfIntegerVectors()不相同]
## function below but is more efficient (both in speed and memory[#下面的函数,而且是更有效(无论是在速度和内存]
## footprint):[#足迹):]
strsplitAsListOfIntegerVectors2 <- function(x, sep=",")
{
tmp <- strsplit(x, sep, fixed = TRUE)
lapply(tmp, as.integer)
}
y2 <- strsplitAsListOfIntegerVectors2(x)
stopifnot(identical(y, y2))
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|