Learn R Programming

powdR (version 1.3.0)

read_xy: Read ASCII XY data

Description

read_xy is a wrapper for read.csv that is designed for space separated XRPD data.

Usage

read_xy(files, header, sep)

Arguments

files

path of the file(s) to be imported.

header

a logical value indicating whether the file contains the names of the variables as its first line. Default = FALSE.

sep

the field separator character. Values on each line of the file are separated by this character. Default = " ", indicating space separated format.

Value

If only one path is supplied then an XY data frame with 2 columns is returned, the first being the 2theta axis and the second being the count intensities. If more than one path is supplied then a multiXY list is returned, with each item in the list being an XY data frame as already described.

Examples

Run this code
# NOT RUN {
#load example XY file
file <- system.file("extdata/D5000/xy/D5000_1.xy", package = "powdR")
xy <- read_xy(file)

#Load multiple XY files
files <- dir(system.file("extdata/D5000/xy", package = "powdR"),
             full.names = TRUE)
xy_list <- read_xy(files)

# }
# NOT RUN {
plot(xy_list, wavelength = "Cu")
plot(xy_list, wavelength = "Cu", interactive = TRUE)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab