class_docstr: The `RBasePredictor` is a thin wrapper for calling R packages.
  In order to use it you need to install R and rpy2.
  
  Note that specific R packages need to be installed, depending
  on which wrapper one needs to run.
  See `RForecastPredictor` and `RHierarchicalForecastPredictor` to know
  which packages are needed.
  
  Parameters
  ----------
  freq
      The granularity of the time series (e.g. '1H')
  prediction_length
      Number of time points to be predicted.
  period
      The period to be used (this is called `frequency` in the R forecast
      package), result to a tentative reasonable default if not specified
      (for instance 24 for hourly freq '1H')
  trunc_length
      Maximum history length to feed to the model (some models become slow
      with very long series).
  r_file_prefix
      Prefix string of the R file(s) where our forecasting wrapper methods
      can be found.
      This is to avoid loading all R files potentially having different
      implementations of the same method, thereby making sure the
      expected R method is in fact used.
class_docstr_tok: ["The","`","RBasePredictor","`","is","a","thin","wrapper","for","calling","R","packages",".","In","order","to","use","it","you","need","to","install","R","and","rpy2",".","Note","that","specific","R","packages","need","to","be","installed",",","depending","on","which","wrapper","one","needs","to","run",".","See","`","RForecastPredictor","`","and","`","RHierarchicalForecastPredictor","`","to","know","which","packages","are","needed",".","Parameters","--","--","--","--","--","freq","The","granularity","of","the","time","series","(","e.g",".","'1H","'",")","prediction_length","Number","of","time","points","to","be","predicted",".","period","The","period","to","be","used","(","this","is","called","`","frequency","`","in","the","R","forecast","package",")",",","result","to","a","tentative","reasonable","default","if","not","specified","(","for","instance","24","for","hourly","freq","'1H","'",")","trunc_length","Maximum","history","length","to","feed","to","the","model","(","some","models","become","slow","with","very","long","series",")",".","r_file_prefix","Prefix","string","of","the","R","file","(","s",")","where","our","forecasting","wrapper","methods","can","be","found",".","This","is","to","avoid","loading","all","R","files","potentially","having","different","implementations","of","the","same","method",",","thereby","making","sure","the","expected","R","method","is","in","fact","used","."]
code: def predict(
      self,
      dataset: Dataset,
      **kwargs,
  ) -> Iterator[Forecast]:
      self._warning_message()
  
      for data in dataset:
          data = self._preprocess_data(data=data)
  
          forecast_dict, console_output = self._run_r_forecast(data)
  
          info = (
              {"console_output": "\n".join(console_output)}
              if self.save_info
              else None
          )
  
          yield self._forecast_dict_to_obj(
              forecast_dict=forecast_dict,
              forecast_start_date=forecast_start(data),
              item_id=data.get("item_id", None),
              info=info,
          )
  
file_path: gluonts/src/gluonts/ext/r_forecast/_predictor.py
imports: from pathlib import Path
  from typing import Dict, Optional, List, Iterator, Tuple
  import pandas
  from gluonts.core.component import validated
  from gluonts.dataset.common import Dataset
  from gluonts.dataset.util import forecast_start
  from gluonts.model.forecast import Forecast
  from gluonts.model.predictor import RepresentablePredictor
  from gluonts.time_feature import get_seasonality
  from subprocess import Popen, PIPE
label_desc: Use image node_id 7 for calling the RBasePredictor obj's underlying member method code with example usage: obj.predict(dataset) without return types