Laboratory of Applied Pharmacokinetics and Bioinformatics
Optimizing drug therapy for populations and individuals

Click the logo to return to Pmetrics home page.
Pmetrics has evolved from decades of work. Please consider a donation to help support continued development. Thank you!
Installation Examples Tips and Tricks

March 24, 2020: As of version 1.9, Pmetrics is distributed through Github.  Instructions on how to install are below.  this is a far simpler install process.  Soon, we hope that Pmetrics will be distributed through CRAN and can be installed like any other package in R.  Version 1.9 should be viewed as a beta pre-release.  Feedback on github for bugs is welcome.

If automatic downloading and installation of gfortran fails when running PMbuild() in step 5, please visit the older instructions on how to manually install gfortan prior to running PMbuild().   

Installation from GitHub  Top

Pmetrics Package Top

Current version: 1.5.2 What's new?

Email us to get Pmetrics for MacOSX

Email us to get Pmetrics for Windows

Do NOT open the archive (.zip or .tgz) file directly. R needs the package to be in this archived format to install properly in Step 5.

R is a freely available statistical software package and programming languange available for Windows, Unix (Mac) and Linux systems. Pmetrics is an add-on package for R. Click the R icon to be linked to the Comprehensive R Archive Network (CRAN) and download the appropriate version for your system.

Although R comes with a basic graphical user interface for writing scripts, Rstudio is a better option. You can get it by clicking their logo. If you prefer to use the native R GUI or another, you can.

Pmetrics needs Fortran to work. We support gfortran, which is free; however, if you have another Fortran installation on your system, email us for help.
Be sure to follow the instructions carefully for your specific system below.



In Rstudio, you can either select the Tools menu and the Install packages option, or click the Install button on the Packages tab of the lower right window in Rstudio.

Make sure you are installing from CRAN and not a local .tgz or .zip archive.

Type "devtools" and install.

Be sure to restart Rstudio before this step! Then, type the following into the R console (lower left window of Rstudio): devtools::install_github("LAPKB/Pmetrics")

If you are prompted to update packages, it is okay to update from CRAN. Choose "2: CRAN packages only". If further prompted "There is a binary version available but the source version is later:" enter "N" or "No" to NOT install from the source version.

  • Pmetrics uses Fortran to compile code to run population model fitting and simulations.
  • When you first load Pmetrics in R with the library(Pmetrics) command, the next command you should run is PMbuild().
  • This will attempt to download and install gfortran if not present on your system, and compile the required, included, Fortran modules.
  • If you neglect to run PMbuid(), the package will not operate correctly.
  • If this is the first time you have installed this version of the Pmetrics and run PMbuid(), the program will inform you that our LAPKB server has noted that a new installation has occurred. We do not collect any identifying information and only aggregate numbers for reporting to granting agencies.
As of version 1.2.9, the function PMtest() will allow you to determine if you have installed all the necessary components to run Pmetrics. If you have not properly installed and loaded Pmetrics and run PMbuild(), you will get an error report when you run PMtest().

To start using Pmetrics, be sure to download the example script, model file, data files, and instruction files from the Example Section. Do also carefully read the User Manual!

Hopefully, you have been able to successfully install all the required components. Please use the LAPK Forum if you are having problems.

Do also carefully read the User Manual!

Hopefully, you have been able to successfully install all the required components. Please use the LAPK Forum if you are having problems.

Examples Top

If you are new to Pmetrics, download a zip file containing an example R script, data .csv file, and fortran model file to run Pmetrics.

Tips and Tricks Top

Here are some things that you can do to make Pmetrics run the way you want it to.

  1. Once Pmetrics is installed into R, load it at the beginning of each R session with the command: library(Pmetrics).
  2. Use the Pmetrics command PMtree() to set up a new project folder tree. You can get help on this command and all Pmetrics commands in R by typing ?command, e.g. ?PMtree
  3. R and Pmetrics are case-sensitive! Capitals matter.
  4. You can change some options in Pmetrics. See ?setPMoptions for help in R.