writerPACI: Save to disk a dataset in the format used by rPACI

Description Usage Arguments Details Examples

View source: R/writeData.R

Description

Write to disk a corneal topography dataset in the format used by rPACI, in a plain text file. The file format consists of (possibly) a header (only for data that were simulated), followed by three separated columns (x and y coordinates of each point and its ring index) and a row per data point. This format is returned by the functions readFile or simulateData.

Usage

1
writerPACI(dataset, filename, sep = ",")

Arguments

dataset

A data.frame containing the corneal topography points, with columns:

x The X Cartesian coordinates of the points
y The Y Cartesian coordinates of the points
ring index Number or index of the ring to which each point belongs
filename

A character string naming a file (including the extension).

sep

The field separator string (by default, ',').

Details

This function writes the data from a data.frame to a plain text file. The file will possibly have a header, followed by a block of three separated columns, according to the usual format used by rPACI, i.e., a list with three columns (x and y coordinates of each point, and its ring index) and a row per data point.

If the given data.frame (named dataset) was produced using simulateData, the resulting text file will also include in its header the Parameters attribute (attr(dataset,'Parameters')), i.e., the list of parameters used for the simulation.

A file stored with writerPACI can later be read using the general reader function readFile or the specific reader function readrPACI.

See more details about the file structure in vignette("topographersDataFormat", package = "rPACI"), about the usage of rPACI in vignette("packageUsage", package = "rPACI"), and about simulation parameters in vignette("simulating", package = "rPACI").

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# Simulating an elliptic dataset, with ellipses axis ratio of 0.8 and an orientation 
# of 45 degrees.
dataset = simulateData(rings = 18, pointsPerRing = 300, 
                       ellipticAxesRatio = 0.8, ellipticRotation = 45)

# Now the dataset can be saved to file using 'writerPACI' (check the working directory
# before saving):
## Not run: 
writerPACI(dataset, "datasetFile.txt")

## End(Not run)
# The file will include as a header the parameters used in the simulation

rPACI documentation built on Nov. 4, 2021, 1:08 a.m.