From f12fe6306c121e5d7e291a7729f080021ce57f35 Mon Sep 17 00:00:00 2001 From: Taha Ahmed Date: Tue, 2 Aug 2011 16:07:31 +0200 Subject: [PATCH] Added empirical_formula to attributes of pdf2df(). Since chemicalformula can be quite a mess for some PDFs. --- xrdtf.R | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xrdtf.R b/xrdtf.R index 297e836..bb78877 100644 --- a/xrdtf.R +++ b/xrdtf.R @@ -147,6 +147,7 @@ pdf2df <- function(pdffile) { # ApplicationVersion, # pdfNumber, # chemicalformula, + # empiricalformula, # wavelength # require(XML) @@ -187,6 +188,7 @@ pdf2df <- function(pdffile) { attr(angles, "ApplicationVersion") <- xmlAttrs(pdf)[[2]] attr(angles, "pdfNumber") <- xmlValue(pdf[["pdf_data"]][["pdf_number"]]) attr(angles, "chemicalformula") <- gsub("[ ]", "", xmlValue(pdf[["pdf_data"]][["chemical_formula"]])) + attr(angles, "empiricalformula") <- gsub("[ ]", "", xmlValue(pdf[["pdf_data"]][["empirical_formula"]])) attr(angles, "wavelength") <- as.numeric(xmlValue(pdf[["graphs"]][["wave_length"]])) # Caution: Do not subset. Subsetting causes all attributes to be lost. return(angles)