R/stereo_mean.R

Defines functions stereo_mean

Documented in stereo_mean

#' @title Stereonet (mean)
#' @description Draws the mean direction and cone of confidence for a set of measurements.
#' @param dir A vector of dir directions in degrees
#' @param dip A vector of dip angles in degrees
#' @param conf.level Confidence level for the cone of confidence (Default is 0.95)
#' @param mean.col Color for the mean and cone of confidence
#' @param add A logical indicating to add or not another set of measurements and its calculations
#' @export
#' @return A stereonet plot of data points and its mean estimations
#' @examples
#' dir <- runif(min = 30, max = 80, n = 20)
#' dip <- runif(min = 10, max = 60, n = 20)
#' stereo_mean(dir, dip)
#'
stereo_mean = function(dir, dip, conf.level = 0.95, mean.col = "red", add = FALSE) {

  r = dir_stats_3D(dir, dip, conf.level = conf.level)

  if (add == TRUE) {
    graphics::par(new = TRUE)
  }

  RFOC::net(col = grDevices::gray(0.85), lwd = .5)
  # stereo_plane(r$Mean.Dir, r$MeanDip, dir = "dip", col = mean.col, add = T)
  RFOC::focpoint(r$Mean.Dir, r$MeanDip, pch = 19, col = mean.col)
  RFOC::addsmallcirc(r$Mean.Dir, 90 - r$MeanDip, r$Cone, col = mean.col)
}
maxgav13/GMisc documentation built on June 12, 2022, 3:48 a.m.