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

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

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

                                        List objects
                                         List对象

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

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

List objects are Vector objects with a "[[", elementType and elementLengths method. The List class serves a similar role as list in base R.
List对象是矢量对象"[[",elementType和elementLengths方法。 List类提供类似的作用在基河名单

It adds one slot, the elementType slot, to the two slots shared by all Vector objects.
它增加了一个插槽,elementType插槽,两个插槽共享所有矢量对象。

The elementType slot is the preferred location for List subclasses to store the type of data represented in the sequence. It is designed to take a character of length 1 representing the class of the sequence elements. While the List class performs no validity checking based on elementType, if a subclass expects elements to be of a given type, that subclass is expected to perform the necessary validity checking. For example, the subclass IntegerList has elementType = "integer" and its validity method checks if this condition is TRUE.
elementType插槽是存储代表序列中的数据类型为List的子类的首选地点。它被设计成一个字符长度为1代表序列中的元素类。而List类执行任何有效性检查elementType,如果子类希望是一个给定类型,预计将进行必要的有效性检查,子类的元素。例如,子类IntegerListelementType = "integer"和其有效性的方法检查,如果条件为真。

To be functional, a class that inherits from List must define at least a "[[" method (in addition to the minimum set of Vector methods).
要功能,从名单继承类必须定义至少一个"[["方法(除了向量方法的最小集合)。


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

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

elementType(x): Get the scalar string naming the class from which all elements must derive.
elementType(x):获取标量字符串,命名所有元素必须派生类。

elementLengths(x): Get the 'length' of each of the elements.
elementLengths(x):长度中的每个元素。

isEmpty(x): Returns a logical indicating either if the sequence has no elements or if all its elements are empty.
isEmpty(x):返回一个逻辑表示,如果序列没有任何元素,如果它的所有元素都是空的。


元素提取(列表样式)----------Element extraction (list style)----------

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

x[[i]]: If defined, return the selected element i, where i is an numeric or character vector of length 1.
x[[i]]:如果定义,返回所选元素i,其中i是一个长度为1的数字或字符的向量。

x$name: Similar to x[[name]], but name is taken literally as an element name.
x$name:x[[name]]类似,但name被当作元素的名称,从字面上。


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

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

lapply(X, FUN, ...): Like the standard lapply function defined in the base package, the lapply method for List objects returns a list of the same length as X, with each element being the result of applying FUN to the corresponding element of X.
lapply(X, FUN, ...):像标准lapply函数定义在基础包,lapplyList对象的方法返回一个列表长度相同X,每个元素结果申请FUNX相应的元素。

sapply(X, FUN, ..., simplify = TRUE, USE.NAMES = TRUE): Like the standard sapply function defined in the base package, the sapply method for List objects is a user-friendly version of lapply by default returning a vector or matrix if appropriate.
sapply(X, FUN, ..., simplify = TRUE, USE.NAMES = TRUE):像标准sapply函数定义在基础包,sapplyList对象的方法是一个用户友好的lapply版本默认情况下返回一个向量或矩阵如果合适。

mapply(FUN, ..., MoreArgs = NULL, SIMPLIFY = TRUE, USE.NAMES = TRUE): Like the standard mapply function defined in the base package, the mapply method for List objects is a multivariate version of sapply.
mapply(FUN, ..., MoreArgs = NULL, SIMPLIFY = TRUE, USE.NAMES = TRUE):像标准的mapply函数的基础包中定义,mapplyList对象的方法是多元的sapply版本。

endoapply(X, FUN, ...): Similar to lapply, but performs an endomorphism, i.e. returns an object of class(X).
endoapply(X, FUN, ...):lapply类似,但执行一个自同态,即返回对象class(X)。

mendoapply(FUN, ..., MoreArgs = NULL): Similar to mapply, but performs an endomorphism across multiple objects, i.e. returns an object of class(list(...)[[1]]).
mendoapply(FUN, ..., MoreArgs = NULL):mapply类似,但执行多个对象的自同态,即返回对象class(list(...)[[1]])。


强迫----------Coercion----------

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




as.env(x, enclos = parent.frame()): Creates an environment from x with a symbol for each names(x). The values are not actually copied into the environment. Rather, they are dynamically bound using makeActiveBinding. This prevents unnecessary copying of the data from the external vectors into R vectors. The values are cached, so that the data is not copied every time the symbol is accessed.
as.env(x, enclos = parent.frame()):创造一种环境,从x每个names(x)的象征。值实际上并没有复制到环境中。相反,它们是动态绑定使用makeActiveBinding。这可以防止外部向量中的数据到R向量不必要的复制。值缓存,使数据不会被复制每次被访问时的符号。

as.list(x, ...), as(from, "list"): Turns x into a standard list.
as.list(x, ...),as(from, "list"):打开x成一个标准的列表。




stack(x, indName = "space", valuesName = "values"): As with stack on a list, constructs a DataFrame with two columns: one for the unlisted values, the other indicating the name of the element from which each value was obtained. indName specifies the column name for the index (source name) column and valuesName specifies the column name for the values.
stack(x, indName = "space", valuesName = "values"):正如stacklist,构建一个具有两列DataFrame:一个非上市的值,表明该元素的名称从每个值获得。 indName指定的列名索引(源名称)列valuesName指定值的列名。




relist(flesh, skeleton): Convert flesh to a list with the same structure (element lengths) as skeleton, a List object. This makes sense when flesh[i] corresponds somehow to unlist(skeleton)[i].
relist(flesh, skeleton)转换fleshskeleton,List对象具有相同的结构(元素长度)的列表。这是有道理的,当flesh[i]莫名其妙地对应unlist(skeleton)[i]。


函数式编程----------Functional Programming----------

The R base package defines some Higher-Order functions that are commonly found in Functional Programming Languages. See ?Reduce for the details, and, in particular, for a description of their arguments. The IRanges package provides methods for List objects, so, in addition to be a vector, the x argument can also be a List object.
的R基包定义了一些常用函数式编程语言的高阶功能。看到?Reduce细节,特别是描述他们的论据。在IRanges包提供List对象的方法,所以,除了是一个向量,x参数也可以是一个List对象。

Reduce(f, x, init, right = FALSE, accumulate = FALSE): Uses a binary function to successively combine the elements of x and a possibly given initial value. See ?Reduce (in the base package) for the details.
Reduce(f, x, init, right = FALSE, accumulate = FALSE):使用二进制功能先后x和可能给定的初始值的元素结合起来,。 ?Reduce(基本包)的细节。

Filter(f, x): Extracts the elements of x for which function f is TRUE. See ?Filter (in the base package) for the details.
Filter(f, x):x的函数f为TRUE提取的元素。 ?Filter(基本包)的细节。

Find(f, x, right = FALSE, nomatch = NULL): Extracts the first or last such element in x. See ?Find (in the base package) for the details.
Find(f, x, right = FALSE, nomatch = NULL):提取x的第一个或最后一个这样的元素。 ?Find(基本包)的细节。

Map(f, ...): Applies a function to the corresponding elements of given List objects. See ?Map (in the base package) for the details.
Map(f, ...):适用于一个给定的列表对象的对应元素的功能。 ?Map(基本包)的细节。

Position(f, x, right = FALSE, nomatch = NA_integer_): Extracts the first or last such position in x. See ?Position (in the base package) for the details.
Position(f, x, right = FALSE, nomatch = NA_integer_):提取的第一个或最后一个x这样的位置。 ?Position(基本包)的细节。


评价----------Evaluating----------

In the code snippets below, envir and data are List objects.
在下面的代码片段,envir和dataList对象。




eval(expr, envir, enclos = parent.frame()): Converts the List object specified in envir to an environment using as.env, with enclos as its parent, and then evaluates expr within that environment.
eval(expr, envir, enclos = parent.frame()):envir指定的环境中使用as.env,转换成List对象enclos作为其母公司,然后计算expr在这种环境中。




with(data, expr, ...): Equivalent to eval(quote(expr), data, ...).
with(data, expr, ...):eval(quote(expr), data, ...)等效。


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


P. Aboyoun and H. Pages



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

Vector for the parent class.
父类的向量。

SimpleList and CompressedList for direct extensions.
simplelist中和CompressedList直接扩展。

IRanges and CompressedLogicalList for example implementations.
IRanges和例如实现CompressedLogicalList。


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


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

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-2-5 14:01 , Processed in 0.035000 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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