Skip to content

R RPGM Functions

These functions are useful in every step of an RPGM app.



Adds a file to the list in the final end step. Path can be absolute or relative to your program directory.


Returns the latest version found in the latest app's project changelog entry. If no version exists, returns an empty string.


R only. Execute the code string in Python.


Python only. Execute the code string in R.


Returns TRUE if the app is executed on RPGM Server, FALSE otherwise.

rpgm.notification(type, message, duration = 5000)

Displays a notification in the bottom right corner of the screen. The notification lasts duration milliseconds and displays message. type can be:

  • "error" for a red message;
  • "info" for a blue message;
  • "success" for a green message., callback)

Remove a callback function from the event system called with rpgm.on() before.

rpgm.on(message, callback)

Set a callback function when RPGM emit an new event. Currently, there is 3 events:

  • didReceiveMessage: when receiving a message from another language like Javascript, Python or R;
  • didUserConnect: when the user connected to the app instance;
  • didUserInitialized: when the user is connected to the app instance and has finished loading Javascript files.

The callback argument is a function that will be called when the message is emitted.

  • In RPGM, opens a file with the default associated program.
  • In RPGM Server, depending on the file type, it will either open the file in a new browser tab or will download the file.

Please note that the file must be in the output folder or the app folder of the app.


Returns an absolute path to a named filename in the output directory.


Mainly used in RPGM Server, this function returns the full URL to a file named filename in the output directory.


Returns an absolute path to a named filename in the program directory.


Plays a sound. Sound can be either "success" or "error".


Sets the next step of the sequence to the specified Step.

rpgm.sendEmail(to, subject, text = "", html = "", cc = "", bcc = "", attachments = list(), replyto = "")

RPGM Server only. Sends an email. to, subject are mandatory. Either text or html should be used (both is also possible).

  • to is a string to the recipient address;
  • subject email subject;
  • text plain text content of the email;
  • html HTML content of the email;
  • cc and bcc other addresses to send the email to;
  • attachments a list() of files to include in the email. Each file is a list with filename and a path properties. For example: list(filename="report.pdf", path="rpgm.outputFile("doc.pdf");
  • replyto an email address to respond to.

rpgm.sendToClipboard(value, headers=FALSE)

Send a value to the user clipboard. If sending an R dataframe, setting headers to TRUE will also append the data with the data frame's headers.


For this to work on RPGM Server, you have to be on HTTPS.

rpgm.sendToJavascript(message, value)

Send a message packet to Javascript, with message as a string and a list of values in value.

rpgm.sendToPython(variableName, content)

Will create a variable variableName in Python with content content.

rpgm.step(file, stepid)

Creates a Step object, used in a lot of GUI functions.


Returns a string with the email address of the user. On RPGM Server, it's the email associated to the user. On RPGM, it's the email of the connected user. If the user is not connected, it returns an empty string.


Returns the name of the current user. On RPGM Server, it's the name of the user as defined in its account settings. On RPGM, it's the Windows/Linux/MacOS username.


Returns a string containing the version of RPGM or RPGM Server.