code: def build_and_install_with_r(self, store_dir):
      if not _host_os_eq(self.target_os):
          raise ValueError(
              "Cannot run R: host {}, target_os {}".format(
                  os.uname()[0], self.target_os
              )
          )
      cmd = [
          "R",
          "CMD",
          "INSTALL",
          self.r_dir,
          "--build",
          "--install-tests",
          "--no-multiarch",
          "--with-keep.source",
      ]
      print("EXECUTING {}".format(" ".join(cmd)))
      r = sp.Popen(cmd, stderr=sp.PIPE, universal_newlines=True)
      for line in r.stderr.readlines():
          sys.stdout.write(line)
          m = re.match(
              r"packaged installation of .* as .*(cat.*[z]).*", line
          )
          if m:
              installation = m.group(1)
      status = r.wait()
      assert status == 0, "Command failed with exit status " + str(
          status
      )
      src = os.path.join(os.getcwd(), installation)
      dst = os.path.join(store_dir, installation)
      if not os.path.samefile(src, dst):
          shutil.move(src, dst)
      return dst
  
imports: from __future__ import print_function
  import argparse
  import os
  import re
  import shutil
  import subprocess
  import sys
  import tempfile
label_desc: Use image node_id 4 for calling the RPackager obj's underlying member method code with example usage: obj.build_and_install_with_r(store_dir) and returns: dst