read_xy: Read ASCII XY data

Description Usage Arguments Value Examples

View source: R/read_xy.R

Description

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

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
#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)

## End(Not run)

powdR documentation built on Aug. 13, 2021, 5:08 p.m.