grepRaw(base)
grepRaw()所属R语言包:base
Pattern Matching for Raw Vectors
模式匹配为原料矢量图
译者:生物统计家园网 机器人LoveR
描述----------Description----------
grepRaw searches for substring pattern matches within a raw vector x.
grepRaw搜索子串pattern在原始向量x比赛。
用法----------Usage----------
grepRaw(pattern, x, offset = 1L, ignore.case = FALSE,
value = FALSE, fixed = FALSE, all = FALSE, invert = FALSE)
参数----------Arguments----------
参数:pattern
raw vector containing a regular expression (or fixed pattern for fixed = TRUE) to be matched in the given raw vector. Coerced by charToRaw to a character string if possible.
要在给定的原始向量匹配一个正则表达式(或固定的模式fixed = TRUE)原始向量。 charToRaw强制转换为字符串,如果可能的话。
参数:x
a raw vector where matches are sought, or an object which can be coerced by charToRaw to a raw vector.
比赛寻求原始向量,或可以通过charToRaw原始向量裹挟的对象。
参数:ignore.case
if FALSE, the pattern matching is case sensitive and if TRUE, case is ignored during matching.
如果FALSE,模式匹配是大小写敏感的,如果TRUE,情况在匹配过程中忽略。
参数:offset
An integer specifying the offset from which the search should start. Must be positive. The beginning of line is defined to be at that offset so "^" will match there.
一个整数,指定偏移量从搜索开始。必须是积极的。开头的行被定义为偏移,所以"^"将匹配。
参数:value
logical. Determines the return value: see "Value".
逻辑。确定返回值:看到“价值”。
参数:fixed
logical. If TRUE, pattern is a pattern to be matched as is.
逻辑。如果TRUE,pattern是一个被视为是匹配的模式。
参数:all
logical. If TRUE all matches are returned, otherwise just the first one.
逻辑。如果TRUE所有的比赛都回来了,否则只是第一个。
参数:invert
logical. If TRUE return indices or values for elements that do not match. Ignored (with a warning) unless value = TRUE.
逻辑。如果TRUE回报指数或不匹配的元素的值。忽略(警告),除非value = TRUE。
Details
详情----------Details----------
Unlike grep, seeks matching patterns within the raw vector x . This has implications especially in the all = TRUE case, e.g., patterns matching empty strings are inherently infinite and thus may lead to unexpected results.
不像grep,力求在原始向量x匹配模式。这种影响,尤其是在all = TRUE的情况下,如,空字符串模式匹配本质上是无限的,因此可能会导致意想不到的结果。
The argument invert is interpreted as asking to return the complement of the match, which is only meaningful for value = TRUE. Argument offset determines the start of the search, not of the complement. Note that invert = TRUE with all = TRUE will split x into pieces delimited by the pattern including leading and trailing empty strings (consequently the use of regular expressions with "^" or "$" in that case may lead to less intuitive results).
被解释为要求返回的比赛,这是唯一有意义的invert补的说法value = TRUE。参数offset决定了搜索的开始,不补。请注意,invert = TRUEall = TRUE将分裂x分隔成片的模式,包括开头和结尾的空字符串(因此使用正则表达式"^"或"$" 在这种情况下,可能会导致不直观的结果)。
Some combinations of arguments such as fixed = TRUE with value = TRUE are supported but are less meaningful.
参数,如一些组合fixed = TRUE用value = TRUE支持,但意义不大。
值----------Value----------
grepRaw(value = FALSE) returns an integer vector of the offsets at which matches have occurred. If all = FALSE then it will be either of length zero (no match) or length one (first matching position).
grepRaw(value = FALSE)返回一个整数向量在比赛时有发生偏移。如果all = FALSE然后它会是长度为零(没有匹配)或长度(第一个匹配的位置)。
grepRaw(value = TRUE, all = FALSE) returns a raw vector which is either empty (no match) or the matched part of x.
grepRaw(value = TRUE, all = FALSE)返回一个原始的向量,这是空的(没有匹配)或匹配的部分x。
grepRaw(value = TRUE, all = TRUE) returns a (potentially empty) list of raw vectors corresponding to the matched parts.
grepRaw(value = TRUE, all = TRUE)返回的列表(可能为空)匹配的部分对应的原始向量。
源----------Source----------
The TRE library of Ville Laurikari (http://laurikari.net/tre/) is used except for fixed = TRUE.
该居民企业库威乐Laurikari(http://laurikari.net/tre/)用于除了fixed = TRUE。
参见----------See Also----------
regular expression (aka regexp) for the details of the pattern specification.
正则表达式(又名regexp)的模式规范的细节。
grep for matching character vectors.
grep匹配的特征向量。
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|