# NOT RUN {
# Load soils xrd data
data(soils)
#Load minerals library
data(minerals)
# }
# NOT RUN {
#Create a standard quartz pattern to align to
quartz <- data.frame(tth = minerals$tth,
                     counts = minerals$xrd$QUA.1)
#Plot the main quartz peak prior to alignment
plot(soils, wavelength = "Cu",
     xlim = c(26,27),
     normalise = TRUE)
#align data
aligned <- align_xy(soils,
                    std = quartz,
                    xmin = 10,
                    xmax = 60,
                    xshift = 0.2)
#replot data
plot(aligned, wavelength = "Cu",
     xlim = c(26,27),
     normalise = TRUE)
#Alternatively try with a single XY object
unaligned <- as_multi_xy(list("quartz" = quartz,
                             "sandstone" = soils$sandstone))
plot(unaligned, wav = "Cu",
     xlim = c(26,27), normalise = TRUE)
sandstone_a <- align_xy(soils$sandstone,
                        std = quartz,
                        xmin = 10,
                        xmax = 60,
                        xshift = 0.3)
aligned <- as_multi_xy(list("quartz" = quartz,
                            "sandstone" = sandstone_a))
plot(aligned, wav = "Cu",
     xlim = c(26,27), normalise = TRUE)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab