Learn R Programming

shotGroups (version 0.8.2)

getXYmat: Extract (x,y)-coordinates (relative to point of aim) from a data frame

Description

Extracts (x,y)- or (x,y,z)-coordinates of the points of impact (relative to the point of aim) from a data frame and returns them as a matrix.

Usage

getXYmat(DF, xyTopLeft = TRUE, relPOA = TRUE, center = FALSE)

Value

A numerical matrix with the (x,y)- or (x,y,z)-coordinates.

Arguments

DF

a data frame containing (at least) either the variables point.x, point.y or x, y defining the bullet holes. For three-dimensional data, variables point.z or z are recognized. Variables aim.x, aim.y, and for three-dimensional data point.z can define the point of aim. If missing, point of aim is assumed to be in the origin 0.

xyTopLeft

logical: is the origin of the absolute coordinate system in the top-left corner? See details.

relPOA

logical: should returned coordinates be relative to the point of aim?

center

logical: center groups to mean (0,0)? If variable series does not exist, all shots are treated as belonging to the same group.

Details

By default, OnTarget PC/TDS' 'Export Point Data' places the origin of the absolute coordinate system in the top-left corner. In OnTarget TDS, this setting can be changed by checking the box 'Tools -> Options -> Options tab -> Data Export -> Invert Y-Axis on Export'. In that case, use xyTopLeft=FALSE. If groups appear to be upside-down, xyTopLeft is the setting to change.

See Also

groupLocation, groupShape, groupSpread

Examples

Run this code
data(DFcm)

# select data from only first series
DFsub <- subset(DFcm, series == 1)
getXYmat(DFsub, xyTopLeft=TRUE, relPOA=TRUE)

Run the code above in your browser using DataLab