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

Installation 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, there are other options. We prefer Rstudio, which is an excellent cross-platform environment for R. You can get it by clicking their logo. If you prefer to use the native R GUI or another, that is fine too.

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.

Windows

Macintosh

Open Rstudio or the R GUI of your choice. Follow the appropriate procedure to install, depending on your software as below.

Rstudio (Mac or Windows)

Mac R GUI

Windows R GUI

You can also use R scripting, although in Rstudio this sometimes (unpredictably) fails. Type the following command into the R console window (don't know what that means?):

install.packages(file.choose())

A file chooser window will open and you can select the Pmetrics unextracted archive file that we sent you. On Mac systems, this will be a Pmetrics_xx.tgz file, and on Windows it will be a Pmetrics_xx.zip file, where xx is the version number, which is currently 1.5.2.

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 compile the required, included, Fortran modules. There are many Fortran compilers available, so Pmetrics will ask you which Fortran compiler is installed on your system. If you don't have one, you will be linked to a page on our website with step-by-step instructions on how to get and install a specific version of gfortran (free) for your system. If you neglect to run PMbuid(), when you first load Pmetrics, then the first time you use a command in Pmetrics that requires Fortran, e.g. NPrun(), ITrun(), ERRrun(), SIMrun(), you will be asked to supply the type of Fortran compiler you have and prompted to run PMbuild().
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, installed and identified your fortran compiler, 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.

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.

  • Unzip the file on your computer.
  • Put the unzipped Examples folder with its subfolders and files in a new directory called "C:\LAPK\Pmetrics" (Windows) or "~/LAPK/Pmetrics" (Mac). If you don't put it in this folder you will have to modify the Pmetrics_examples.R file (next point).
  • Open the Pmetrics_examples.R file in the Rscript folder. It contains commented code to introduce you to 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.