Added empirical_formula to attributes of pdf2df().

Since chemicalformula can be quite a mess for some PDFs.
master
Taha Ahmed 13 years ago
parent ed1853b706
commit f12fe6306c

@ -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)

Loading…
Cancel
Save