The powdR package

Build Status CRAN_Status_Badge Total_Downloads


powdR is an open source implementation of the full pattern summation approach to quantitative mineralogy from X-ray powder diffraction data (Chipera and Bish 2002, 2013; Eberl 2003), written in the R programming language. It seeks to make quantitative phase analysis from XRPD data a faster and more user-friendly procedure.

This short tutorial explains the installation and basic use of powdR, which requires a prior installation of R. A more detailed tutorial of the package is provided in the pacakge Vignette, and video tutorials of the powdR web application can be found on the powdR YouTube channel.


The stable version of powdR is on CRAN:


Alternatively, the development version can be downloaded from GitHub

#Install devtools if you don't already have it on your machine


Basic usage

#> powdR: Full Pattern Summation of X-Ray Powder Diffraction Data

#Load some soils to quantify

#Load a powdRlib reference library of pure patterns

#Quantify a sample
q <-  fps(lib = minerals,
          smpl = soils$sandstone,
          refs = minerals$phases$phase_id,
          std = "QUA.1")
#> -Aligning sample to the internal standard
#> -Interpolating library to same 2theta scale as aligned sample
#> -Optimising...
#> -Removing negative coefficients and reoptimising...
#> -Computing phase concentrations
#> -Internal standard concentration unknown. Assuming phases sum to 100 %
#> ***Full pattern summation complete***

#Inspect the phase concentrations (summarised by name)
#>       phase_name phase_percent
#> 1         Illite        1.2599
#> 2     K-feldspar        1.2666
#> 3      Kaolinite        1.3476
#> 4 Organic-Matter       41.2340
#> 5    Plagioclase        1.1540
#> 6         Quartz       53.7379

#Inspect the quantification
plot(q, wavelength = "Cu")

Alternatively, plot(q, wavelength = "Cu", interactive = TRUE) provides an interactive plot for better inspection of the fit.

The powdR Shiny app

To run powdR via the Shiny web applicationp, use run_powdR(). This loads the application in your default web browser. The application has eight tabs:

  1. Reference Library Builder: Allows you to create and export a powdRlib reference library from two .csv files: one for the XRPD measurements, and the other for the ID, name and reference intensity ratio of each pattern.
  2. Reference Library Viewer: Facilitates quick inspection of the phases within a powdRlib reference library.
  3. Reference Library Editor: Allows the user to easily subset a powdRlib reference library .
  4. Full Pattern Summation: A user friendly interface for iterative full pattern summation of single samples.
  5. Automated Full Pattern Summation: A user friendly interface for automated full pattern summation of single samples.
  6. Results viewer: Allows for quick inspection of results derived from full pattern summation.
  7. Results editor: Allows for results from previously saved powdRfps and powdRafps objects to be edited via addition or removal of reference patterns to the fitting process.
  8. Help Provides a series of video tutorials (via YouTube) detailing the use of the powdR Shiny application.


Chipera, Steve J., and David L. Bish. 2002. “FULLPAT: A full-pattern quantitative analysis program for X-ray powder diffraction using measured and calculated patterns.” Journal of Applied Crystallography 35 (6): 744–49.

———. 2013. “Fitting Full X-Ray Diffraction Patterns for Quantitative Analysis: A Method for Readily Quantifying Crystalline and Disordered Phases.” Advances in Materials Physics and Chemistry 03 (01): 47–53.

Eberl, D. D. 2003. “User’s guide to ROCKJOCK - A program for determining quantitative mineralogy from powder X-ray diffraction data.” Boulder, CA: USGS.