PGM Documentation

PGM Documentation

  • RCode
  • RPGM
  • Server

›API Reference

Getting started

  • Documentation
  • Installation
  • RPGM Software

RPGM Project

  • Introduction
  • Sequences (.pseq)
  • GUI (.pgui)
  • Widgets

Tutorials

  • Getting started
  • Dynamism & Layout
  • Plotly
  • CSS
  • CSS for Grid

API Reference

  • R GUI Functions
  • R RPGM Functions
  • R Script Functions
  • R XLSX Functions
  • CSS Reference
  • Widget Properties
  • Widget Types

R Script Functions

These functions are available while an R script is executing in a Script step in RPGM.

Functions

script.setProgress(show, progress, message)

Shows or hides a progress bar in the current script step.

  • show must be set to TRUE for showing the bar and to FALSE for hiding it ;
  • progress is a number between 0 and 100 representing the progression ;
  • message is a custom message to show below the progress bar.

Here is an example code:

script.setProgress(TRUE, 60, "Exporting to csv format...");

Here is a complete example simulating a 10 seconds length script which updates the progress bar every two seconds:

getCoolText <- function(i)
{
    if(i == "0") return("Calculating ISS position...");
    if(i == "1") return("Generating graphics...");
    if(i == "2") return("Fetching infos from file...");
    if(i == "3") return("Exporting to csv format...");
    return("Success!");
}

starttime <- proc.time()[3][1];
lastout <- starttime;
i <- 0;
script.setProgress(TRUE, i*20, getCoolText(i));
continue <- TRUE;
while(continue)
{
    newtime <- proc.time()[3][1];
    if(newtime - starttime > 10)
    {
        continue = FALSE;
    }
    if(newtime - lastout > 2)
    {
        i <- i + 1;
        script.setProgress(TRUE, i*20, getCoolText(i));
        lastout <- newtime;
    }
}
Last updated on 13/04/2020
← R RPGM FunctionsR XLSX Functions →
  • Functions
    • script.setProgress(show, progress, message)
PGM Documentation
Docs
RPGM Server
More
Main PGM Solutions website
Copyright © 2022 PGM Solutions