Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

clone

Object cloner


Description

Generic function to clone objects

Usage

clone(x, ...)

Arguments

x

An object to clone

...

Further arguments, ignored

Value

A clone of the object

Methods

clone

signature(x = "jobjRef"): clone a java object reference (must implement Cloneable)

clone

signature(x = "jarrayRef"): clone a java rugged array (not yet implemented)

clone

signature(x = "jrectRef"): clone a java rectangular array (not yet implemented)

Warning

The implementation of clone for java object references uses the clone method of the Object class. The reading of its description in the java help page is strongly recommended.

Examples

p1 <- .jnew("java/awt/Point" )
  p2 <- clone( p1 )
  p2$move( 10L, 10L )
  p1$getX() 

  # check that p1 and p2 are not references to the same java object
  stopifnot( p1$getX() == 0 )
  stopifnot( p2$getX() == 10 )

rJava

Low-Level R to Java Interface

v1.0-4
LGPL-2.1
Authors
Simon Urbanek <simon.urbanek@r-project.org>
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.