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

R语言 IRanges包 Vector-class()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-2-25 22:33:00 | 显示全部楼层 |阅读模式
Vector-class(IRanges)
Vector-class()所属R语言包:IRanges

                                        Vector objects
                                         矢量对象

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

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

The Vector virtual class serves as the heart of the IRanges package and has over 90 subclasses. It serves a similar role as vector in base R. The Vector class includes two slots: metadata (via extension of the Annotated class) and elementMetadata. Their purpose is defined below.
虚拟类的矢量作为心脏的IRanges包,并有超过90子类。它提供类似的作用为向量,在碱基R. Vector类包括两个插槽:metadata(通过扩展注释类)和elementMetadata。他们的目的是定义见下文。

The Vector class supports the storage of global and element-wise metadata with its metadata and elementMetadata slots. The metadata slot can store a list of metadata pertaining to the whole object and the elementMetadata slot can store a DataTable (or NULL) for element-wise metadata with a row for each element and a column for each metadata variable.
Vector类的metadata和elementMetadata插槽支持全球和元素明智的元数据存储。 metadata插槽可以存储整个对象和elementMetadata插槽可以存储一个DataTable(或NULL)一排每个元素的元数据元素和相关的元数据列表每个元数据变量列。

To be functional, a class that inherits from Vector must define at least a length, names and "[" method.
要功能,从Vector继承类必须定义至少一个length,names和"["方法。


存取----------Accessors----------

In the following code snippets, x is a Vector object.
在下面的代码片段,x是一个Vector对象。

length(x): Get the number of elements in x.
length(x):元素x的数量。

NROW(x): Defined as length(x) for any Vector object that is not a DataTable object. If x is a DataTable object, then it's defined as nrow(x).
NROW(x):length(x)任何矢量对象,这不是一个DataTable对象的定义。 x如果是一个DataTable对象,那么它定义为nrow(x)。

names(x), names(x) <- value: Get or set the names of the elements in the Vector.
names(x),names(x) <- value:获取或设置Vector中的元素的名称。

nlevels(x): Returns the number of factor levels.
nlevels(x):返回因子水平。

elementMetadata(x), elementMetadata(x) <- value: Get or set the DataTable holding local metadata on each element. The rows are either not named or named according to the names of the elements. Optional, may be NULL.
elementMetadata(x), elementMetadata(x) <- value:获取或设置DataTable中每个元素的本地元数据控股。行未命名或根据元素的名称命名。可选的,可能是NULL。

values(x), values(x) <- value: Alternative to elementMetadata functions.
values(x), values(x) <- value:替代elementMetadata功能。


子集----------Subsetting----------

In the code snippets below, x is a Vector object or regular R vector object. The R vector object methods for window and seqselect are defined in this package and the remaining methods are defined in base R.
在下面的代码片段,x是一个Vector对象或定期&#341;矢量对象。在R矢量对象的方法window和seqselect在这个包中定义和其余的方法定义在基河

x[i, drop=TRUE]: If defined, returns a new Vector object made of selected elements i, which can be missing; an NA-free logical, numeric, or character vector; or a logical Rle object. The drop argument specifies whether or not to coerce the returned sequence to a standard vector.
x[i, drop=TRUE]:如果定义,返回一个新Vector对象中选定的元素i,可丢失; NA无逻辑,数字或字符的向量;或逻辑RLE对象。 drop参数指定是否要强迫返回的序列到一个标准的向量。

x[i] <- value: Equivalent to seqselect(x, i) <- value.
x[i] <- value:seqselect(x, i) <- value等效。

window(x, start = NA, end = NA, width = NA, frequency = NULL, delta = NULL, ...): Extract the subsequence window from the Vector object using:
window(x, start = NA, end = NA, width = NA, frequency = NULL, delta = NULL, ...):提取从媒介使用对象序列窗口:




start, end, width The start, end, or width
start,end,width开始,结束或宽度




frequency, delta Optional arguments that specify
frequency,delta可选参数指定

In general, this is more efficient than using "[" operator.
在一般情况下,这是多使用"["运营商的有效。

window(x, start = NA, end = NA, width = NA, keepLength = TRUE) <- value: Replace the subsequence window specified on the left (i.e. the subsequence in x specified by start, end and width) by value. value must either be of class class(x), belong to a subclass of class(x), be coercible to class(x), or be NULL. If keepLength is TRUE, the elements of value are repeated to create a Vector with the same number of elements as the width of the subsequence window it is replacing. If keepLength is FALSE, this replacement method can modify the length of x, depending on how the length of the left subsequence window compares to the length of value.
window(x, start = NA, end = NA, width = NA, keepLength = TRUE) <- value:更换序列左侧指定的窗口(即序列在xstart中指定,end和width)value的 。 value必须是类的class(x),属于一个子类的class(x),class(x),是强制转换或NULL。如果keepLength是TRUE元素value重复创建一个矢量与相同数量的元素的宽度序列窗口,它正在取代。如果keepLength是FALSE,此替代方法可以修改的长度x,取决于左序列窗口的长度如何比较长的value。

seqselect(x, start=NULL, end=NULL, width=NULL): Similar to window, except that multiple consecutive subsequences can be requested for concatenation. As such two of the three start, end, and width arguments can be used to specify the consecutive subsequences. Alternatively, start can take a Ranges object or something that can be converted to a Ranges object like an integer vector, logical vector or logical Rle. If the concatenation of the consecutive subsequences is undesirable, consider using Views.
seqselect(x, start=NULL, end=NULL, width=NULL):window,除了多个连续子序列的相似,可串联的要求。作为这样两个三个start,end,width参数可以用来指定连续子序列。另外,start可以采取范围对象或东西可以转化为像一个整数向量,向量逻辑或逻辑RLE的范围对象。如果连续子序列的串联是不可取的,可以考虑使用Views。

seqselect(x, start=NULL, end=NULL, width=NULL) <- value: Similar to window<-, except that multiple consecutive subsequences can be replaced by a value whose length is a divisor of the number of elements it is replacing. As such two of the three start, end, and width arguments can be used to specify the consecutive subsequences. Alternatively, start can take a Ranges object or something that can be converted to a Ranges object like an integer vector, logical vector or logical Rle.
seqselect(x, start=NULL, end=NULL, width=NULL) <- value:类似window<-,value,其长度是它被替换的元素的数量除数除多个连续子序列可以取代。作为这样两个三个start,end,width参数可以用来指定连续子序列。另外,start可以采取范围对象或东西可以转化为像一个整数向量,向量逻辑或逻辑RLE的范围对象。

head(x, n = 6L): If n is non-negative, returns the first n elements of the Vector object. If n is negative, returns all but the last abs(n) elements of the Vector object.
head(x, n = 6L):n如果非负,返回第n个元素的矢量对象。 n如果是负,返回所有,但最后abs(n)Vector对象中的元素。

tail(x, n = 6L): If n is non-negative, returns the last n elements of the Vector object. If n is negative, returns all but the first abs(n) elements of the Vector object.
tail(x, n = 6L)如果n非负,返回Vector对象的最后一个n个元素。 n如果是负,返回所有,但第一abs(n)Vector对象中的元素。

rev(x): Return a new Vector object made of the original elements in the reverse order.
rev(x):返回一个新Vector对象的原始元素以相反的顺序。

rep(x, times, length.out, each), rep.int(x, times): Repeats the values in x through one of the following conventions:
rep(x, times, length.out, each),rep.int(x, times):重复值x通过以下约定:




times Vector giving the number of times to repeat each element if of length length(x), or to repeat the whole vector
times向量的次数重复每个元素如果长length(x),或重复整个向量




length.out Non-negative integer. The desired length of
length.out非负整数。所需的长度




each Non-negative integer.  Each element of x is
each非负整数。每个x元素

subset(x, subset): Return a new Vector object made of the subset using logical vector subset, where missing values are taken as FALSE.
subset(x, subset):返回一个新Vector对象的使用逻辑向量的子集subset,遗漏值都为FALSE。


结合----------Combining----------

In the code snippets below, x is a Vector object.
在下面的代码片段,x是一个Vector对象。

c(x, ...): Combine x and the Vector objects in ... together. Any object in ... must belong to the same class as x, or to one of its subclasses, or must be NULL. The result is an object of the same class as x.
c(x, ...):结合x和...一起Vector对象。任何对象...“必须属于同一类的x,或者其子类之一,或必须是NULL。其结果是为x同一类的对象。




append(x, values, after = length(x)): Insert the Vector values onto x at the position given by after. values must have an elementType that extends that of x.
append(x, values, after = length(x)):插入Vectorvalues到x在after给定的位置。 values必须有一个elementType延伸x。


循环----------Looping----------

In the code snippets below, x is a Vector object.
在下面的代码片段,x是一个Vector对象。

tapply(X, INDEX, FUN = NULL, ..., simplify = TRUE): Like the standard tapply function defined in the base package, the tapply method for Vector objects applies a function to each cell of a ragged array, that is to each (non-empty) group of values given by a unique combination of the levels of certain factors.
tapply(X, INDEX, FUN = NULL, ..., simplify = TRUE):像标准tapply函数定义在基础包,tapplyVector对象的方法适用于每一个衣衫褴褛的阵列单元功能,这是每一个(非空)的某些因素水平的独特组合定值组。

shiftApply(SHIFT, X, Y, FUN, ..., OFFSET = 0L, simplify = TRUE, verbose = FALSE): Let i be the indices in SHIFT, X_i = window(X, 1 + OFFSET, length(X) - SHIFT[i]), and Y_i = window(Y, 1 + SHIFT[i], length(Y) - OFFSET). Calculates the set of FUN(X_i, Y_i, ...) values and return the results in a convenient form:
shiftApply(SHIFT, X, Y, FUN, ..., OFFSET = 0L, simplify = TRUE, verbose = FALSE):让i是SHIFT,X_i = window(X, 1 + OFFSET, length(X) - SHIFT[i]),Y_i = window(Y, 1 + SHIFT[i], length(Y) - OFFSET)指数。 FUN(X_i, Y_i, ...)值计算,并在方便的形式返回结果:




SHIFT A non-negative integer vector of shift values.
SHIFT移值的非负整数向量。




X, Y The Vector or R vector objects to shift.
X,Y向量或R矢量对象转移。




FUN The function, found via match.fun, to be
FUN的功能,通过match.fun发现,是




... Further arguments for FUN.
... FUN进一步的论据。




OFFSET A non-negative integer offset to maintain throughout
抵消了非负整数偏移保持整个




simplify A logical value specifying whether or not the
simplify一个逻辑值,指明是否




verbose A logical value specifying whether or not to
verbose一个逻辑值,指定是否

aggregate(x, by, FUN, start = NULL, end = NULL, width = NULL,       frequency = NULL, delta = NULL, ..., simplify = TRUE)): Generates summaries on the specified windows and returns the result in a convenient form:
aggregate(x, by, FUN, start = NULL, end = NULL, width = NULL,       frequency = NULL, delta = NULL, ..., simplify = TRUE)):对指定的窗口生成摘要,并在方便的形式返回结果:




by An object with start, end, and
by一个与start,end,对象和




FUN The function, found via match.fun, to be
FUN的功能,通过match.fun发现,是




start, end, width the start, end, or width of the window. If by is missing, then must supply two of the
start,end,width开始,结束,或窗口的宽度。 by如果丢失,则必须提供两个




frequency, delta Optional arguments that specify
frequency,delta可选参数指定




... Further arguments for FUN.
... FUN进一步的论据。




simplify A logical value specifying whether or not the
simplify一个逻辑值,指明是否


作者(S)----------Author(s)----------


P. Aboyoun



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

Rle and XRaw for example implementations.
为RLE和XRaw的例如实现。

List for a direct extension that serves a similar role as list in base R.
供应碱基河作为列表类似的作用直接延伸名单

DataTable which is the type of objects returned by the elementMetadata accessor.
DataTable的是类型的返回elementMetadata存取的对象。

Annotated which Vector extends.
注明该向量延伸。


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


  showClass("Vector")  # shows (some of) the known subclasses[表演(部分)已知的子类]

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-2-5 10:48 , Processed in 0.022771 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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