Received 7 October 2015; accepted 25 January 2016; published 28 January 2016
The igneous rocks have always been recognized as extremely difficult to set a systematic classification, owing of their almost infinite variation and the gradation from one kind to another in many ways. According to the IUGS (International Union of Geological Science), Subcommission on the Systematics of Igneous Rocks, the primary classification of igneous rocks must be based according to their modal mineral composition, expressed as volume percent  . Nevertheless, where these data are unavailable or can not be determined owing to fine-grained mineral assemblage, glassy content or changes in the original mineralogy, then other criteria based on bulk chemical composition may be used.
Computed from its chemical composition, the normative mineralogy is an alternative approach for modal classification and useful for set the naming of igneous rocks and plot specific compositions in phase diagrams. The CIPW Norm (acronym from the surnames of the authors: Cross, Iddings, Pirrson and Washington) is based upon assumptions about the order of mineral formation and known phase relationships of rocks and minerals, using simplified mineral formulas. It is the most commonly used calculation algorithm to estimate the standard mineral assemblages for igneous rocks, generated over more than a hundred years ago  and thereafter modified by some authors as the years passed (e.g.,  -  ). In spite of there are many softwares and spreadsheets available to generate the CIPW Norm (summarized the most popular computer programs in  ), the most used schemes are based on an outdated algorithm, and lacks the rigor suggested by the modern geochemistry (    ). Furthermore, all of them depend on proprietary operating systems. In this paper, I shall present NORRRM a user-created extension of R language  , which main purpose is to calculate comprehensive normative compositions of igneous rocks based on the algorithm after  .
2. Installation and General Considerations
Practically all Norms calculated today are produced by computer, but it is essential to understand the algorithm used by the software to know the nature of the calculation through the source code. To facilitate the access to the script and adapt it to your needs, NORRRM is released under GNU General Public License (GPL), both a free software license, and a copyleft license. It is important to note that the term “free software” was coined by  to refers the four freedoms that users of software should have: 0) to run the program, for any purpose; 1) to study how the program works; 2) to redistribute copies; 3) the freedom to improve the program, and release your improvements to the public, so that the whole community benefits. In this sense, proprietary software may limit their use within the geoscience community because have licensing terms that restricted their usage to a specific set of software/hardware. NORRRM is distributed free of charge as cross-platform program that can be run on any operating system with an installed R environment (version 3.1.1 or greater).
NORRRM can be downloaded from CRAN repositories (http://cran.r-project.org/) or installed via R terminal:
For its part, like any function in R, the NORRRM’s functions include arguments as objects (mainly conditional expressions) which are defined by default within the script; these default values may be modified by the user by specifying options in the console. Then, the overall use of NORRRM is explained starting from the command-line interface.
3. Input Data
Results of major elements in geochemical analysis, traditionally used in Norm calculation are submitted as oxides and expressed in weight percent (% wt). These are SiO2, TiO2, Al2O3, MnO, MgO, CaO, Na2O, K2O and P2O5. A special case is the Fe, because it can be determined as FeO and Fe2O3, but sometimes expressed as “total Fe” and given as either FeOt and Fe2O3t (t = total). On the other hand, trace element data are expressed in parts per million (ppm) of element and exceptionally exceeding 2000 ppm (0.2%). The trace elements that can be used in NORRRM are Ba, Cl, Co, Cr, Cs, F, Li, Ni, Rb, S, Sr, V and Zr. Additionally, the oxides concentrations of Cr2O3, NiO and SO3 (expressed as % wt) are handled like trace elements as well. However Cr2O3 are preferable to Cr and NiO to Ni. Sulfur concentration when available is reported as either SO3 or S, in which case their separate identity should be maintained.
There are many different ways to import data sets of almost any file extensions using R. However, the header format of the input data to run NORRRM should be specific. Examples of data are provided by the CRAN and can be called by commands as:
# load TestTAS data
to call a compilation of major elements data for 37 representative samples of volcanic rocks. This data is also available as part of IUGSTAS, the software developed by the IUGS  to calculate the CIPW Norm. On the other hand, to call a compilation of more than 1500 major- and trace-elements analysis of igneous rocks from central Andes  can be used the command:
# load Andes data
4. Functions of NORRRM
The Total Alkalis (TA: Na2O + K2O) vs Silica (S: SiO2) diagram is one of the most useful classification schemes available for volcanic rocks. TAS classification can be used to assign names to many common types of volcanic rocks based upon the relationships between the combined alkali content and the silica content, because it play an important role in propose a modal mineralogy and determining the normative mineralogy  .
It is important to note that the TAS classification is purely descriptive, and that no genetic significance is implied. Furthermore, analyses of rocks that weathered, altered, metasomatized or have undergone crystal accumulation should be used with caution in this or any classification scheme, as spurious results may be obtained   . The TASplot function provides a powerful model of TAS plot considering that analyses are recalculated on an anhydrous basis. This graphical function can be displayed in the screen by typing the following at the command line:
> TASplot (filename, color="blue")
where “filename” is a dataset of major elements stored in R and, “colour” is the color of the points (another graphical parameters can be specified by the arguments). The output of TASplot function create a ggplot2 object  , an output example of this function is shown in Figure 1.
In most terrestrial magmas, Fe is overwhelmingly the most abundant element occurring in more than one oxide-
Figure 1. Output plot of the function TASplot (applied in “Andes” data): chemical classi- fication of volcanic rock using TAS (Total Alkali vs Silica) diagram   . The red line dividing alkalic and subalkalic series is after Irvine and Baragar  To decide on the shared fields Ba-Te and TD-T, must be used the normative mineralogy: Ba should contain [Ol] > 10%, Te should contain [Ol] < 10%, TD should contain [Q] > 20%, T should contain [Q] < 20%. Abbreviations: B: Basalt, BA: Basalticandesite, A: Andesite, D: Dacite, R: Rhyolite, PB: Picrobasalt, TB: Trachybasalt, BTA: Basaltictrachyandesite, TA: Trachy- andesite, TD: Trachydacite, T: Trachyte, Ba: Basanite, Te: Tephrite, PT: Phonotephrite, TP: Tephriphonolite, P: Phonolite, F: Foidite.
tion state, chiefly as Fe2+ and Fe3+  , both in nature as the Norm, the oxidation states behave differently, giving rise to different types of minerals. The ratio of these oxidation states (described as FeO/(FeO + Fe2O3), Fe3+/(Fe3+ + Fe+) or Fe2O3/FeO) varies widely in different rock types  . Since Fe2O3 and FeO are rarely separately determined, in which case are reported as “total Fe”, the Fe-ratio must be calculated in some way owing this ratio can profundly affect the degree of silica saturation in the norm and, the nature and abundance of the species of critical normative minerals  . In this sense, Middlemost  has proposed a range of oxidation ratios (as Fe2O3/FeO) for use with volcanic rocks, depending on the type of rock drawn in TAS diagram. The Fe-ratio is calculated by default in NORRRM following the method of  , helped by the function pnt.in.poly within of SDMTools package  .
Furthermore, another method to fix Fe-oxidation ratio is available, Le Maitre  determine an approach of Fe ratio partitioning based on multiple regression analyses with a large database of young volcanic and plutonic rocks, using (Na2O + K2O) vs SiO2 diagram. From linear regression models this author computed the Equation (1) to specifying oxidation ratios:
and for volcanics rocks the Equation (2),
for plutonics rocks. In specific cases where FeO and Fe2O3 are available, no method is used to correct the Fe analyses and the measured ratios are maintained. Once determined the Fe-oxidation ratio, the major elements data is recalculated to 100% on an anhydrous basis, subtracting the Loss On Ignition (LOI) on the sum of major elements. An example to call AdjRock function applied to a data set is given as:
# recalculated the geochemical data on an anhydrous basis
AdjRock(filename, Volcanic=FALSE, AdjTAS=FALSE,Cancrinite=TRUE)
where “filename” is a dataset of major elements stored in R, the denial of the arguments “Volcanic” and “AdjTAS” involves that the Fe-oxidation ratio is performed by plutonic Le Maitre’s equation and, the affirmation of third argument allows add CO2 as major element.
The feedstock of the CIPW Norm computation is the mol proportion of each constituent, which is determined dividing the adjust oxide by the appropriate molecular weight. The most up-to-date weights of elements recommended by the IUPAC (International Union of Pure and Applied Chemistry) Commission on Atomic Weights and Isotopic Abundances have been used for the calculation of molecular weights  .
# load and view OxiWeigth data
It is important to note that the CIPW norm is widely used by igneous petrologists as an aid for naming the igneous rocks. In this sense, step-by-step procedure is shown in many classical books of both geochemistry and igneous petrology (e.g.,  -  ). However, Verma et al.  proposed their scheme based on mass-balance principles and claimed your algorithm as standard methodology for CIPW norm computation, calling it Standard Igneous Norm (SIN). In this regard, NORRRM adheres to the main rules set by the SIN.
To compute the Norm, it is necessary set up chemical formulae compatible with hypothetical phases at an idealized magma oxides saturation. Such an approach to generate Norm minerals requires continuous monitoring of oxides mol proportion abundance, every step of the Norm that involve the formation of a mineral, consumes a specified quantity of chemical components, having two or three options depending on its saturation. Once the quantity of specific mol proportion is exhausted, this entity is no longer available for mineral generation. The process of mineral creation continues until the entire composition is consumed, tracking the silica saturation provided by silicate formation. After the step of established silica saturation, if the silica deficient is positive, some minerals previously calculated are undone to release some of their components to construct remaining minerals, until the deficiency has been reduced to zero and the provisional normative minerals have been converted to definite ones. Finally, the computation is completed by conversion of the mol proportions to weight percentages of normative minerals, multiplying molar data by the respective mineral molecular weights (Table 1).
# load and view MinWeight data
It is important to note that the calculation is based on the following assumptions: 1) the magma from which
Table 1. Mineral formulae, weigths and densities to be used in the NORRM computations.
*Partial mineral weights before the correction on the weight of some of its oxide (e.g., FeO, CaO, K2O, Na2O or Cr2O3) at its mineral formulae. **Theoretical densities after  .
the rock is derived is assumed to be anhydrous, therefore hydrous phases such as amphibole and micas are ignored; 2) the ferromagnesian minerals are assumed to be free of Al2O3, therefore the amount of alumina must be used to calculate feldspar and feldspathoid; 3) differs between the two endmembers of the solid solution series (e.g., forsterite (Mg-endmember: 2MgOSiO2) and fayalite (Fe-endmember: 2FeOSiO2)) and 4) due to the algorithm, several mineral pairs are considered to be incompatible (e.g., [Qz] and [Ol] or [Hy] and [Ne]), therefore never appear together in the norm although in real rocks that may be present. An example to call CIPW function applied to a data set is given as:
# calculate the CIPW Norm
> CIPW(filename, Volcanic=TRUE, AdjTAS=FALSE, Cancrinite=TRUE)
where “filename” is a dataset of major elements stored in R, the affirmation of the arguments “Volcanic” and the denial “AdjTAS” involves that the adjust of Fe-oxidation ratio is performed by Volcanic Le Maitre’s equation and, the affirmation of the Cancrinite argument allows calculate Sodium Carbonate (Na2OCO2) in the Norm.
In spite altogether the trace elements used in the Norm rarely exceed more than 0.6% of the weights of the oxides recalculated on an anhydrous basis. Some rocks may attain high concentrations of these components and significantly influence the results of the norm (e.g., high Ba-Sr rocks, mafic-ultramafic rocks with high concentrations of compatible elements). An important difference between the SIN (using trace element) and the function CIPW.trace is that NORRRM only performed one adjust to an anhydrous basis, done after the conversion of trace concentration data (ppm) to percent, handling the concentrations of major and trace elements as a whole.
The trace elements are used in the Norm computation by two different ways: 1) assigned to different minerals according to generally accepted chemical substitutions of trace elements into major elements (e.g., CaO wtmol. corr = ((xCaO × CaO wt・mol) + (xSrO × SrO wt・mol) + (xBaO × BaO wt・mol)) and K2O wt・mol・corr = ((xK2O × K2O wt・mol) + (xRb2O × Rb2O wt・mol) + (xCs2O × Cs2O wt・mol)) or 2) assigned to the creation of theoretical minerals (e.g., ZrO2 on [Zr]). To compute the CIPW Norm taking into account trace elements is by following command:
# calculate the CIPW Norm with major- and trace-elements
where “filename” is a dataset of major and trace elements stored in R, the absence of arguments involves the compliance of defined by default arguments in the function: Volcanic = TRUE, AdjTAS = TRUE, Cancrinite = FALSE, Calcite = FALSE, digits = 3.
5. Output Data
Any calculation in R, and consequently in NORRRM computations, produce results that are not automatically stored in the memory. They can be appended to the current environment for further processing, turning them into objects by standard operators (<− or =). On the other hand, to check the stoichiometric balance and generate quality data, the results of the sum of the weights of the oxides on an anhydrous basis, the sum of the weights of the calculated normative minerals and the differences between them were plotted on histograms to prove the data reliability (Figure 2).
The histograms have been performed by both CIPW and CIPW.trace functions applied on Andes database included in the CRAN, which has wide compositional range. The patterns show normal distribution and gives sums of normative minerals and oxide weigths of 100% (±0.005). Futhermore, the differences between the input (oxide weigths) and output (normative minerals) data are very small, ranging in most cases between −0.0025 and +0.0025, with the exception of some observations. In addition, NORRRM computes several geochemical parameters and casts them in the numeric output. This parameters include commonly utilized petrological ratios and indices (Table 2).
6. Concluding Remarks
NORRRM is a program for handling geochemical data of igneous rocks and to calculate the CIPW Norm, which
Figure 2. Histograms of the sum of the weights of the oxides on an anhydrous basis (A and D), the sum of the weights of the calculated normative minerals (B and E) and differences (∆ output) between the sum of the weights of the oxides and normative minerals (C and F) obtained by both CIPW (in blue) and CIPW.trace (in red) functions applied on data from central Andes (n = 1511, function: data(Andes)), rounded to the third decimal place (default argument).
has the attribute to be run on any operating computer systems. The NORRRM’s capacity on the number of samples that can be processed is limited only by the limits of information processed by R. Although there are a lot of programs to calculate the Norm, most of them depend on others software or hardware that do not have long-term support or are based on an outdated algorithm. The proposed scheme, gives precisely and accurately data, using a free software.
Table 2. Petrological parameters calculated by NORRRM.
I spend my free spare time (there is no such thing as free time) learning R. So, thanks to R staff.
 Le Maitre, R.W., Streckeisen, A., Zanettin, B., Le Bas, M.J., Bonin, B., Bateman, P., Bellieni, G., Dudek, A., Efremova, S., Keller, J., Lameyre, J.A., Sabine, P.A., Schmid, R., Sorensen, H. and Wooley, A.R. (2002) Igneous Rocks: A Classification and Glossary of Terms: A Classification and Glossary of Terms: Recommendations of the International Union of Geological Sciences, Subcommission on the Systematics of Igneous Rocks. Cambridge University Press, Cambridge.
 Cross, W., Iddings, J.P., Pirsson, L.V. and Washington, H.S. (1902) A Quantitative Chemico-Mineralogical Classification and Nomenclature of Igneous Rocks. The Journal of Geology, 10, 555-690.
 Mamani, M., W?rner, G. and Sempere, T. (2010) Geochemical Variations in Igneous Rocks of the Central Andean Orocline (13?S to 18?S): Tracing Crustal Thickening and Magma Generation through Time and Space. Geological Society of America Bulletin, 122, 162-182. http://dx.doi.org/10.1130/B26538.1
 Le Bas, M.J., Le Maitre, R., Streckeisen, A. and Zanettin, B. (1986) A Chemical Classification of Volcanic Rocks Based on the Total Alkali-Silica Diagram. Journal of Petrology, 27, 745-750.
 Carmichael, I.S. (1991) The Redox States of Basic and Silicic Magmas: A Reflection of Their Source Regions? Contributions to Mineralogy and Petrology, 106, 129-141.
 Van der Wal, J., Falconi, L., Januchowski, S., Shoo, L. and Collin, S. (2014) Species Distribution Modelling Tools: Tools for Processing Data Associated with Species Distribution Modelling Exercises.
 Wieser, M.E., Holden, N., Coplen, T.B., B?hlke, J.K., Berglund, M., Brand, W.A., De Bièvre, P., Gr?ning, M., Loss, R.D., Meija, J., Hirata, T., Prohaska, T., Schoenberg, R., O’Connor, G., Walczyk, T., Yoneda, S. and Zhu, X.K. (2013) Atomic Weights of the Elements 2011. Pure and Applied Chemistry, 85, 1047-1078. http://dx.doi.org/10.1351/PAC-REP-13-03-02
 Waples, D.W. and Waples, J.S. (2004) A Review and Evaluation of Specific Heat Capacities of Rocks, Minerals, and Subsurface Fluids. Part 1: Minerals and Nonporous Rocks. Natural Resources Research, 13, 97-122. http://dx.doi.org/10.1023/B:NARR.0000032647.41046.e7
 Poldervaart, A. and Parker, A.B. (1964) The Crystallization Index as a Parameter of Igneous Differentiation in Binary Variation Diagrams. American Journal of Science, 262, 281-289.
 Frost, T.S. (2001) The Geographic Sources of Foreign Subsidiaries’ Innovations. Strategic Management Journal, 22, 101-123. http://dx.doi.org/10.1002/1097-0266(200101)22:2<101::AID-SMJ155>3.0.CO;2-G