nipype.interfaces.r module

Interfaces to run R scripts.

RCommand

Link to code

Bases: CommandLine

Interface that runs R code

>>> import nipype.interfaces.r as r
>>> r = r.RCommand(rfile=False) 
>>> r.inputs.script = "Sys.getenv('USER')" 
>>> out = r.run()  
Mandatory Inputs:

script (a string) – R code to run. Maps to a command-line argument: -e "%s" (position: -1).

Optional Inputs:
  • args (a string) – Additional parameters to the command. Maps to a command-line argument: %s.

  • environ (a dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’) – Environment variables. (Nipype default value: {})

  • rfile (a boolean) – Run R using R script. (Nipype default value: True)

  • script_file (a pathlike object or string representing a file) – Name of file to write R code to. (Nipype default value: pyscript.R)

RCommand.set_default_r_cmd(r_cmd)

Set the default R command line for R classes.

This method is used to set values for all R subclasses.

RCommand.set_default_rfile(rfile)

Set the default R script file format for R classes.

This method is used to set values for all R subclasses.

nipype.interfaces.r.get_r_command()