calc_mean: Calculate grain-size mean (M1)

Description Usage Arguments Value Author(s) Examples

View source: R/calc_mean.R

Description

The function calculates the first moment of grain-size distributions, using either the arithmetic or geometric method.

Usage

1
calc_mean(data, classes, unit = "phi", method = "arithmetic")

Arguments

data

Numeric vector or matrix, grain-size distribution(s) to be evaluated.

classes

Numeric vector, grain-size class limits corresponding to the input data set.

unit

Character value, unit of the grainsize classes. One out of "phi" and "mu", default is "phi".

method

Character value, method used for caluclation. One out of "arithmetic" and "geometric", default is "arithmetric".

Value

Numeric vector, mean grain-size.

Author(s)

Michael Dietze

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## load example data set
data(LA950)

## calculate arithemtric mean in metric scale
calc_mean(data = LA950$y, 
          classes = LA950$x, 
          unit = "mu")
          
## calculate arithmetic mean in phi-scale
calc_mean(data = LA950$y, 
          classes = convert_units(mu = LA950$x), 
                                  unit = "phi")
                                  
## calculate geometric mean
calc_mean(data = LA950$y, 
          classes = LA950$x, 
          unit = "mu", 
          method = "geometric")
                     

coffeemuggler/grainsize documentation built on June 21, 2017, 12:24 a.m.