Learn R Programming

rscala (version 3.2.6)

scalaType: Get or Specify a Scala Type

Description

This function gets the Scala type of an rscala reference. It also, together with the associated convenience objects, specifies a Scala type for transcompilation purposes.

Usage

scalaType(type)

stI0

stD0

stL0

stR0

stS0

stI1

stD1

stL1

stR1

stS1

stI2

stD2

stL2

stR2

stS2

Arguments

type

An rscala reference or a character vector of length one giving a Scala type.

Value

An object of class rscalaType whose value is a character vector of length one indicating a Scala type.

Format

See 'Value' below.

Details

The convenience objects are of the form stXY (where X is in {I, D, L, R, S} and Y is in {0, 1, 2}) as as indicated below:

  • I corresponds to Scala's Int and R's integer.

  • D corresponds to Scala's Double and R's double.

  • L corresponds to Scala's Boolean and R's logical.

  • R corresponds to Scala's Byte and R's raw.

  • S corresponds to Scala's String and R's character.

  • 0 corresponds to a Scala primitive and an R length one vector.

  • 1 corresponds to a Scala array and an R vector.

  • 2 corresponds to a Scala array of arrays and an R matrix.

For example, stS2 is equivalent to Scala's scalaType("Array[Array[String]]") and R's type for matrix(character()). Also, stL1 is equivalent to Scala's scalaType("Boolean") and R's type for logical(1).

Examples

Run this code
# NOT RUN {
scalaType("Double")
stD0
scalaType("Array[Byte]")
stR1
scalaType("Array[Array[Int]]")
stI2

# }

Run the code above in your browser using DataLab