Changed from factors to strings in pdf2df().

Added stringsAsFactors = FALSE to dataframe.
master
Taha Ahmed 14 years ago
parent 52adff796b
commit ed1853b706

@ -130,6 +130,7 @@ pdf2df <- function(pdffile) {
# For example the PDF files produced by the PDF database at Angstrom's X-ray lab # For example the PDF files produced by the PDF database at Angstrom's X-ray lab
# NOTE: sometimes intensity values are specified as less than some value. # NOTE: sometimes intensity values are specified as less than some value.
# In those cases, this function simply strips the less-than character. # In those cases, this function simply strips the less-than character.
# (Perhaps not true, see the int.Tex column)
# ARGS: pdffile (complete path and filename to PDF file) # ARGS: pdffile (complete path and filename to PDF file)
# VALUE: dataframe with 9 columns: # VALUE: dataframe with 9 columns:
# thth angles (numeric), # thth angles (numeric),
@ -137,10 +138,10 @@ pdf2df <- function(pdffile) {
# h index (numeric), # h index (numeric),
# k index (numeric), # k index (numeric),
# l index (numeric), # l index (numeric),
# hkl indices (factor of strings), # hkl indices (string),
# hkl.TeX indices formatted for LaTeX (factor of strings), # hkl.TeX indices formatted for LaTeX (string),
# intensity (numeric), # intensity (numeric),
# int.TeX intensity formatted for LaTeX (factor of strings) # int.TeX intensity formatted for LaTeX (string)
# attr: This function sets the following attributes: # attr: This function sets the following attributes:
# ApplicationName, # ApplicationName,
# ApplicationVersion, # ApplicationVersion,
@ -155,7 +156,7 @@ pdf2df <- function(pdffile) {
# #
angles <- data.frame(NULL) angles <- data.frame(NULL)
for (i in 1:length(pdf[["graphs"]][["stick_series"]])) { for (i in 1:length(pdf[["graphs"]][["stick_series"]])) {
angles <- rbind(angles, data.frame(# angles <- rbind(angles, data.frame(stringsAsFactors = FALSE,#
thth = as.numeric(xmlValue(pdf[["graphs"]][["stick_series"]][[i]][["theta"]])), thth = as.numeric(xmlValue(pdf[["graphs"]][["stick_series"]][[i]][["theta"]])),
d = as.numeric(xmlValue(pdf[["graphs"]][["stick_series"]][[i]][["da"]])), d = as.numeric(xmlValue(pdf[["graphs"]][["stick_series"]][[i]][["da"]])),
h = as.numeric(xmlValue(pdf[["graphs"]][["stick_series"]][[i]][["h"]])), h = as.numeric(xmlValue(pdf[["graphs"]][["stick_series"]][[i]][["h"]])),

Loading…
Cancel
Save