srapply(ShortRead)
srapply()所属R语言包:ShortRead
Apply-like function for distribution across MPI-based clusters.
申请状分布跨越基于MPI的聚类功能。
译者:生物统计家园网 机器人LoveR
描述----------Description----------
This lapply like function evaluates locally or, if Rmpi or parallel is loaded (and Rmpi workers spawned), across nodes in a cluster. Errors in evaluation of FUN generate warnings; results are trimmed to exclude results where the error occurs.
这lapply像函数的计算结果,在本地或如果Rmpi或parallel被载入(Rmpi工人催生)横跨在聚类的节点。 FUN产生警告的评价结果的误差;修剪,以排除发生错误。
用法----------Usage----------
srapply(X, FUN, ..., fapply = .fapply(), reduce = .reduce(),
USE.NAMES = FALSE, verbose = FALSE)
参数----------Arguments----------
参数:X
Tasks to be distributed. X should be an object for which lapply or sapply are defined (more precisely, mpi.parLapply, mpi.parSapply, or mclapply). Performance is best when these objects are relatively small, e.g., file names, compared to the work to be done on each by FUN.
分配的任务。 X应该是一个对象为lapply或sapply定义(更确切地说,mpi.parLapply,mpi.parSapply或mclapply)。表现最好的是,当这些对象相对较小,例如,文件名,比工作,在每个FUN。
参数:FUN
A function to be applied to each element of X. The function must have ... or named argument verbose in its signature. It is best if it makes no reference to variables other than those in its argument list. or in loaded packages (the ShortRead package is available on remote nodes).
一个功能被应用到每个元素X。该函数必须有...或命名参数verbose在其签名。这是最好的,如果它没有比在其参数列表的变量的引用。或在装包(ShortRead包是可用的远程节点上)。
参数:...
Additional arguments, passed to FUN.
额外的参数,通过FUN。
参数:fapply
An optional argument defining an lapply-like function to be used in partitioning X. See details, below.
一个可选的参数,定义一个lapply像功能可用于在分区X。看到细节,下文。
参数:reduce
Optional function accepting a list (the result of fapply and summarizing this. The default reports errors in function evaluation as warnings, returning the remaining values as elements of a list. See details below for additional hints.
接受一个可选功能列表(fapply和总结。默认的报告警告功能评价中的错误,并返回作为一个列表的元素的剩余价值。额外的提示,请参阅下面的详细信息。
参数:USE.NAMES
If TRUE and if X is character, use X as names for the result unless it had names already.
如果TRUE如果X是字符,请使用Xnames结果,除非它有名字已经。
参数:verbose
Report whether evaluation is local or mpi-based; also forwarded to FUN, allowing detailed reports from remote instances.
报告是否是本地的还是基于MPI的评价;也转发到FUN,允许从远程实例的详细报告。
Details
详情----------Details----------
The default value for fapply is available with ShortRead:::.fapply(). It tests the getOption("srapply_fapply") for value “Rmpi” or “parallel”.
默认值fapply是可用ShortRead:::.fapply()。它测试的价值的“Rmpi”或“水货”getOption("srapply_fapply")。
If Rmpi is indicated, fapply ensures that ShortRead is required on all workers, and then invokes mpi.parLapply with arguments X, FUN, ..., and verbose. The function FUN is wrapped so that errors are returned as objects of class SRError with type RemoteError. If no workers are available, the code evaluates FUN so that errors are reported as with remote evaluation.
如果Rmpi表示,fapply确保ShortRead是required对所有的工人,然后调用mpi.parLapply带参数的X,FUN,...,verbose。功能FUN包裹,使返回错误类型SRError类RemoteError对象。如果没有可用的工人,代码评估FUN这样的错误与远程评估报告。
If parallel is indicated, fapply invokes mclapply with arguments as for mpi.parLapply.
如果parallel表示,fapply调用mclapply的mpi.parLapply的论据。
Custom reduce functions might be written as reduce=function(lst) unlist(lst, use.names=TRUE).
reduce自定义reduce=function(lst) unlist(lst, use.names=TRUE)功能可能被写入。
值----------Value----------
The returned value depends on the value of reduce, but by default is a list with elements containing the results of FUN applied to each of X. Evaluations resulting in an error have been removed, and a warning generated.
返回值取决于值reduce,但默认情况下是一个元素包含FUN每个X结果列表。在一个错误造成的评估已被删除,并生成一个警告。
作者(S)----------Author(s)----------
Martin Morgan <mtmorgan@fhcrc.org>
举例----------Examples----------
## ... or 'verbose' required in argument, [#...或“详细”参数,]
srapply(1:10, function(i, ...) i)
## collapse result to vector[#崩溃的矢量结果]
srapply(1:10, function(i, ...) i, reduce=unlist)
x <- srapply(1:10, function(i, ...) {
if (runif(1)<.2) stop("oops") else i
})
length(x) ## trimmed to exclude errors[#修剪,以排除错误]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|