contact_data: Calculate Data for Contact Analysis

Description Usage Arguments Details Value Examples

Description

contact_data generates data from domain-coded drillhole data suitable for plotting contact analysis plots. For each possible pairing of categorical domain codes it reports the distance and grade of drillhole samples from each contact of the domain pairing. The distance for the first domain in the pairing ('left' side) is reported as a negative distance for plotting purposes.

Usage

1
2
contact_data(df, grade, bhid = bhid, from = from, to = to, x = x,
  y = y, z = z, domain = domain, max_dist = 15, min_samp = 5)

Arguments

df

Data frame with columns defined in the following arguments.

grade

Name of column in df containing numeric values to be averaged by contact distance.

bhid

Name of column in df containing character or numeric categorical hole ID (default 'bhid') identifying each unique drillhole.

from, to

Name of numeric columns of df with the downhole distance to the start and end of sample intervals (defaults from and to).

x, y, z

Name of numeric columns of df with the cartesian coordinates of the sample mid-points (defaults x, y, and z).

domain

Name of the column in df containing the character or numeric categorical codes for domains across which contact analysis will be performed (default domain).

max_dist

Positive numeric scalar for the maximum contact distance to be calculated (default 15).

min_samp

Positive integer scalar for the minimum number of samples on each side of the contact (default 5). If less than this the data won't be returned. This helps remove domain pairings with too few data.

Details

Uses nested for loops, which is not ideal for speed. I am sure that more can be done by vecorizing one or more loops, but, for now, it works and is fast enought to be practical. For example: the dataset 'dholes' contains 24,673 records in 371 drillholes with 13 valid domain contact pairings. This dataset takes <50 seconds to process on a fast laptop (2018 i9 CPU).

Value

A list of two data frames 'detail' and 'summary'. 'detail' contains all data points while 'summary' contains mean grade by binned distances.

Examples

1
2
3
4
5
6
# Smaller dataset for speed.
dholes_sub <- dholes[dholes$domain < 4000,]
ca <- contact_data(dholes_sub, grade, max_dist = 20)

# Extract only certain contacts from contact data.
ca_1100 <- purrr::map(ca, ~dplyr::filter(.x, grepl("1100", contact)))

truemoid/contactr documentation built on May 24, 2019, 9:58 p.m.