estimate_n: Estimate count sum

Description Usage Arguments Details References Examples

View source: R/est2_n.R

Description

Estimate count sum from percent data

Usage

1
2
3
4
5
6
7
8
9
estimate_n(
  x,
  percent_col = "percent",
  taxon_col = "taxon",
  ID_cols,
  digits = 2,
  nmin = 1L,
  nmax = 1000L
)

Arguments

x

data.frame of percent data in long format

percent_col

character giving name of column with percent data

taxon_col

character giving name of column with taxon names

ID_cols

character vector giving name of one or more columns with sample IDs

digits

numeric; how many decimal places are the percent reported to

nmin

integer; possible count sum to start direct search at

nmax

integer; possible count sum to end direct search at

Details

Estimates the count sum with two methods. The first estimate is 100/p_min where p_min is the minimum percent. The second estimate is the value N within the range nmin:nmax for which all p/100 * N is an integer for all percent p. The proportion of taxa for which this is an integer is given by the score. A warning is given if the score is below 1. This can happen nmax is less than the count sum, or if the percent have been incorrectly calculated (perhaps an error in rounding) or percent are calculated from different count sums for different taxa (eg. upland trees shrubs and herbs vs aquatics).

@return A nested tibble #'

References

Telford (2019) Tools for identifying unexpectedly low microfossil count sums. Preprint.

Examples

1
2
3
4
5
require("dplyr")
data(last_chance)
last_chance0  %>% 
  tidyr::pivot_longer(cols = -c(age_calBP, totcaps), names_to = "taxon", values_to = "percent") %>% 
  estimate_n(digits = 2, ID_cols = c("age_calBP", "totcaps"))

richardjtelford/count_checker documentation built on Jan. 31, 2022, 7:12 p.m.