class_docstr: Interface that runs R code
  
  >>> import nipype.interfaces.r as r
  >>> r = r.RCommand(rfile=False) # doctest: +SKIP
  >>> r.inputs.script = "Sys.getenv('USER')" # doctest: +SKIP
  >>> out = r.run()  # doctest: +SKIP
docstr: Generates commands and, if rfile specified, writes it to disk.
docstr_tok: ["Generates","commands","and",",","if","rfile","specified",",","writes","it","to","disk","."]
code: def _gen_r_command(self, argstr, script_lines):
      """Generates commands and, if rfile specified, writes it to disk."""
      if not self.inputs.rfile:
          # replace newlines with ;, strip comments
          script = "; ".join(
              [
                  line
                  for line in script_lines.split("\n")
                  if not line.strip().startswith("#")
              ]
          )
          # escape " and $
          script = script.replace('"', '\\"')
          script = script.replace("$", "\\$")
      else:
          script_path = os.path.join(
              os.getcwd(), self.inputs.script_file
          )
          with open(script_path, "w") as rfile:
              rfile.write(script_lines)
          script = "source('%s')" % script_path
  
      return argstr % script
  
file_path: nipype/nipype/interfaces/r.py
imports: import os
  from shutil import which
  from ..None import config
  from .base import CommandLineInputSpec, InputMultiPath, isdefined, CommandLine, traits, File, Directory
label_desc: Use image node_id 6 for calling the RCommand obj's underlying member method code with example usage: obj._gen_r_command(argstr, script_lines) and returns: unknown