simRingCount: Calculate simulated ring count for a given group and target

View source: R/simRingCount.R

simRingCountR Documentation

Calculate simulated ring count for a given group and target

Description

Calculates the simulated ring count given a group, bullet diameter, and target type.

Usage

simRingCount(xy, center = FALSE, target, caliber, unit = 'cm')

## S3 method for class 'data.frame'
simRingCount(xy, center = FALSE, target, caliber, unit = 'cm')

## Default S3 method:
simRingCount(xy, center = FALSE, target, caliber, unit='cm')

Arguments

xy

either a numerical (n x 2)-matrix with the (x,y)-coordinates of n points (1 row of coordinates per point), or a data frame with either the variables x, y or point.x, point.y as well as aim.x, aim.y giving the point of aim (= bullseye). If missing, point of aim (bullseye) is assumed to be in (0,0).

center

logical: center groups to mean (0,0) first? If variable series does not exist, all shots are treated as belonging to the same group. Only available in method simRingCount.data.frame().

target

either a character value with the name of a target in targets or a list with a target definition containing the same components as those in targets (name, unitTarget, nRings, ringD10, ringD10i, ringW, cols, colsTxt).

caliber

a numerical value indicating the bullet diameter in mm.

unit

measurement unit of the (x,y)-coordinates in xy. Possible values are 'cm', 'mm', 'm', 'in', 'ft', 'yd'.

Details

The returned ring count assumes that bullet holes exactly have the diameter given by caliber, and that rings exactly have the diameter/width given in the definition of target. The count thus ignores the possibility of ragged bullet holes as well as the physical width of the ring markings. The simulated ring count therefore need not be equal to the calculated ring count from the corresponding physical target.

Value

A list with the following components:

count

the total ring count.

max

the maximum ring count achievable with the given number of shots.

rings

the individual ring count for each shot.

See Also

targets, getDistToCtr

Examples

simRingCount(DFscar17, target='ISSF_100m', caliber=5.56, unit='in')

# ring count for all groups in DFcm data set
rc <- by(DFcm, DFcm$series, FUN=simRingCount, target='BDS9',
         caliber=9, unit='cm')

sapply(rc, function(x) with(x, c(count=count, max=max)))

shotGroups documentation built on Sept. 18, 2022, 1:08 a.m.