R

LabTalk Object Type:

Utility Object


The R (or RObj) object provides script access for running basic R commands and exchange data with R console.

Methods:

Method Description
R.Init()

Initiate the R application.

R.Reset()

Clear all variables in current R session.

R.Exec(strCommand)

Execute one or multiple R command lines via string strCommand.

R.Send(OriginDataset, Rvariable,type)

Send Origin dataset OriginDataset to R as variable Rvariable, data type can be -1 = auto, 0 = vector, 1 = matrix, 2 = data frame.

R.Receive(OriginDataset, Rvariable, type)

Receive R variable as Origin dataset OriginDataset, data type can be -1 = auto, 0 = vector, 1 = matrix, 2 = data frame.

R.GetReal(LabTalkVar, RVariable)

Assign the numeric value of R variable RVariable to Origin variable LabTalkVar.

R.SetReal(LabTalkVar, RVariable)

Assign the numeric value of Origin variable LabTalkVar to R variable RVariable.

R.GetStr(LabTalkVar, RVariable)

Assign the string value of R string variable RVariable to Origin string variable LabTalkVar.

R.SetStr(LabTalkVar, RVariable)

Assign the string value of Origin string variable LabTalkVar to R string variable RVariable.

  • Logical vector FALSE,TRUE in R will be received as 0, 1, respectively in Origin worksheet.
  • Origin's missing values "--", empty cell "" will be sent to R as NA.
  • Origin has a method for checking whether R is installed:
IsApplicationInstalled("R")=; //0 = no, 1 = yes.
  • Origin has a method for getting R version:
GetApplicationVersion("R")=; //in R v4.1.3 returns a value like 4.13

Example

Please view this page for examples.