readDataSMT {shotGroups}R Documentation

Read data files exported by the Silver Mountain e-target system

Description

Reads in data from CSV files exported by the Silver Mountain e-target system. Several files can be read with one call.

Usage

readDataSMT(fPath = ".", fNames, fPat, combine = TRUE)

Arguments

fPath

a character string containing the path to the folder with the SMT output files, e.g. 'c:/folder/smtFiles'.

fNames

a character vector containing the file names of the files that should be read in.

fPat

a character string containing the regular-expression that describes all names of files that should be read in. E.g., '^points[[:digit:]]{2}\\.txt$' for filenames 'points**.txt', where ** are 2 digits. See regex, glob2rx.

combine

logical: combine the data into one big data frame with combineData?

Details

If fNames is provided, fPat is ignored.

If neither fNames nor fPat is provided, and we are in interactive mode under Windows, files can be chosen interactively.

This function is basically a wrapper for read.csv.

Output files need to be comma-separated files (file type .csv) from Silver Mountain e-target. Files need to contain exactly the following variable names in this order: string, shooter, frame, distance, date, score, moa_x, moa_y, scope_x, scope_y, adj_x, adj_y, v, adj_y_avg, adj_y_sd, v_avg, v_sd.

Coordinates are converted from MOA to inch, distance is converted from meter to yard.

For reading in other text files, see readDataMisc.

Value

With combine=FALSE: a list of data frames, each from one file that was read in. This list can then be combined into one big data frame by combineData.

file1

data frame containing data from the first file

file2

data frame containing data from the second file

...

more data frames

With combine=TRUE: a combined data frame from combineData.

See Also

read.csv, regex, glob2rx, combineData, readDataOT1, readDataOT2, readDataShotMarker, readDataMisc

Examples

## Not run: 
# folder with Silver Mountain e-target output files
fPath   <- 'c:/folder/smtFiles'
fileNam <- c('pts01.csv', 'pts02.csv')    # desired files in that folder
DFgroup <- readDataSMT(fPath, fNames=fileNam, combine=TRUE)

## alternatively, specify filename pattern for all files to be read in
fPath   <- 'c:/folder/smtFiles'           # folder with data files
fPat    <- '^pts[[:digit:]]{2}\\.csv$'    # filename pattern
DFgroup <- readDataSMT(fPath, fPat=pattern, combine=TRUE)

## End(Not run)

## result should look like this
data(DFcm)
head(DFcm)

[Package shotGroups version 0.8.2 Index]