Skip to contents

[Stable]

Set user options for Pmetrics

Usage

setPMoptions(
  sep,
  dec,
  server_address,
  compilation_statements,
  backend,
  rust_template,
  report_template,
  gfortran_path,
  func_defaults,
  quiet = F
)

Arguments

sep

The field separator character; "," by default, but could be ";" or another separator.

dec

The decimal separator character; "." by default, but could be "," for example.

server_address

Specify address of server for remote runs. Server must be set up separately. This functionality is coming soon.

compilation_statements

a vector with tho string elements that defines the compilation arguments for single thread and parallel executions. Custom compile commands should be entered using <exec> as a placeholder for the executable filename, and <files> as a placeholder for the files to be linked and compiled. Example: gfortran -O3 -o <exec> <files>. If a single compilation statement is provided, it will be used for both kind of compilations.

backend

Name of compiler to use. Default is "fortran" (for now) but can be "rust" to use rust compiler. Currently, only NPAG is available in rust.

rust_template

Only used if backend is set to "rust".

report_template

Format of the plots included in the summary report presented at the end of a run. Default is to use "plotly", but can be set to "ggplot".

gfortran_path

Path to gfortran compiler.

func_defaults

Change the default argument value for any Pmetrics function or method. func_defaults should be a list, with each item itself a list of function name = list(arg1 = value, arg2 = value,...). For example: func_defaults = list(plot.PM_op = list(stats = T, marker = list(color = "red")), qgrowth = list(percentile = 50)). This is an incredibly powerful tool to customize your Pmetrics experience. If you store your options in the external location (recommended), these custom argument values will persist when Pmetrics is updated, as long as the argument is unchanged in the function. You can only change Pmetrics function arguments, as this is a very powerful tool that can mess up your R installation if used carelessly. You can add new argument defaults to the same function at a later time, as old entries will not be erased. To restore original defaults, either change it back to the original value or use editPMoptions to directly edit the JSON file and delete the entries no longer desired. Use caution with this, as a malformed file will cause errors. To remove all defaults the JSON file should contain "func_defaults": {}. After saving the file, you will need to base::detach() the Pmetrics package and reload it with base::library() for the changes to take effect.

quiet

Suppress warning messages. Default FALSE.

Value

The user preferences file will be updated. This will persist from session to session and if stored in the external location, through Pmetrics versions.

Details

When the Pmetrics package is first loaded with library(Pmetrics), this function will be called. It will obtain the user's locale from system information and set the appropriate language. It will look for a PMoptions.json file in a hidden folder outside of the Pmetrics package. If that does not exist, it will offer to create this for you. With this choice, your options will persist when Pmetrics is updated. If you choose to store the options within the package architecture, your options will be erased every time you update Pmetrics. After you make your choice, you will not be presented with that choice again. However, if you wish to later move your options from the internal location to the external one, use movePMoptions.

The function will obtain Pmetrics user options from the PMoptions.json file by calling getPMoptions, set them for the session and update any missing options with default values.

Author

Michael Neely