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

R语言 rJava包 jarray()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-2-22 21:02:42 | 显示全部楼层 |阅读模式
jarray(rJava)
jarray()所属R语言包:rJava

                                         Java array handling functions
                                         Java数组处理功能

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

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

.jarray takes a vector (or a list of Java references) as its argument, creates a Java array containing the elements of the vector (or list) and returns a reference to such newly created array.
.jarray作为它的参数向量(或Java引用列表),创建一个Java数组,包含向量的元素(或列表),这些新创建的数组,并返回一个引用。

.jevalArray takes a reference to a Java array and returns its contents (if possible).
.jevalArray需要一个Java数组的引用,并返回它的内容(如果可能的话)。


用法----------Usage----------


.jarray(x, contents.class = NULL, dispatch = TRUE )
.jevalArray(obj, rawJNIRefSignature = NULL, silent = FALSE)



参数----------Arguments----------

参数:x
vector or a list of Java references
向量或Java引用列表


参数:contents.class
common class of the contained objects, see details
通用类包含的对象,查看详细信息


参数:obj
Java object reference to an array that is to be evaluated
Java对象的引用进行评估是一个数组,


参数:rawJNIRefSignature
JNI signature that whould be used for conversion. If set to NULL, the signature is detected automatically.
JNI签名,whould用于转换。如果设置为NULL,自动检测签名。


参数:silent
if set to true, warnings are suppressed
如果设置为true,被抑制的警告


参数:dispatch
logical. If TRUE the code attemps to dispatch to either a jarrayRef object for rugged arrays and jrectRef objects for rectangular arrays.  
逻辑。如果为TRUE的代码attemps派遣无论是jarrayRef坚固的矩形阵列的阵列和jrectRef对象的对象。


Details

详情----------Details----------

.jarray: The input can be either a vector of some sort (such as numeric, integer, logical, ...) or a list of Java references. The contents is pushed to the Java side and a corresponding array is created. The type of the array depends on the input vector type. For example numeric vector creates double[] array, integer vector creates int[] array, character vector String[] array and so on. If x is a list, it must contain Java references only (or NULLs which will be treated as NULL references).
.jarray:输入可以是一个某种向量(如数字,整数,逻辑...)或Java引用列表。内容推到Java端,并创建一个相应的数组。数组的类型依赖于输入向量类型。例如数字向量创建double[]阵列,整数向量创建int[]数组,字符向量String[]阵列等。如果x是一个列表,它必须只包含Java引用(或NULLSNULL引用将作为治疗)。

The contents.class parameter is used only if x is a list of Java object references and it can specify the class that will be used for all objects in the array. If set to NULL no assumption is made and java/lang/Object will be used. Use with care and only if you know what you're doing - you can always use .jcast to cast the entire array to another type even if you use a more general object type. One typical use is to construct multi-dimensional arrays which mandates passing the array type as contents.class.
只有当contents.class是一个Java对象引用的列表,它可以指定阵列中的所有对象将要使用的类,用于x参数。如果设置NULL没有假设,java/lang/Object将使用。小心使用,只有当你知道你在做什么 - 你总是可以使用.jcast整个阵列转换为另一种类型,即使你使用一个更一般的对象类型。一个典型的用途是建设任务传递contents.class数组类型的多维数组。

The result is a reference to the newly created array.
结果是一个新创建的数组的引用。

The inverse function which fetches the elements of an array reference is .jevalArray.
反函数获取数组引用元素是.jevalArray。

.jevalArray currently supports only a subset of all possible array types. Recursive arrays are handled by returning a list of references which can then be evaluated separately.
.jevalArray目前仅支持所有可能的数组类型的一个子集。递归阵列处理返回一个引用的列表,然后可以分别评估。


值----------Value----------

.jarray returns a Java array reference (jarrayRef or jrectRef) to an array created with the supplied contents.
.jarray返回一个Java数组引用(jarrayRef或jrectRef)所提供的内容创建了一个数组。

.jevalArray returns the contents of the array object.
.jevalArray返回数组对象的内容。


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



a <- .jarray(1:10)
print(a)
.jevalArray(a)
b <- .jarray(c("hello","world"))
print(b)
c <- .jarray(list(a,b))
print(c)
# two-dimensional array resulting in int[2][10][二维数组的int [2] [10]]
d <- .jarray(list(a,a),"[I")
print(d)

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-4-21 19:59 , Processed in 0.021790 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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