-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Miguel Alvarez
committed
Oct 27, 2016
1 parent
c1ec8d3
commit 6fd049b
Showing
5 changed files
with
54 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
Package: Lexiguel | ||
Version: 0.0.0.9008 | ||
Version: 0.0.0.9009 | ||
Date: 2016-10-27 | ||
Title: Miscellaneous Functions | ||
Authors@R: person("Miguel", "Alvarez", email="[email protected]", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
\name{curve_area} | ||
\alias{curve_area} | ||
|
||
\title{Calculation of area below a curve.} | ||
\description{ | ||
This function calculates the area below a curve by the trapezoidal rule. | ||
} | ||
\usage{ | ||
curve_area(x, y, bottom=0) | ||
} | ||
\arguments{ | ||
\item{x}{A numerical vector with the ordinate values.} | ||
\item{y}{A numerical vector with the abscissa values.} | ||
\item{bottom}{A numerical value indicating the bottom for area calculation.} | ||
} | ||
\details{ | ||
The argument \code{bottom} can be adjusted to the minimum observed values an | ||
will be particularly useful when values of \code{y} are negative. | ||
|
||
Curves going bellow the \code{bottom} value will get a negative value of area | ||
and therefore subtracted when \code{y} cuts the bottom value. | ||
|
||
This function was originally written as internal function for the calculations | ||
done by \code{\link{sloss}}. | ||
} | ||
\value{ | ||
A numeric value. | ||
} | ||
\author{ | ||
Miguel Alvarez (\email{malvarez@uni-bonn.de}). | ||
} | ||
\examples{ | ||
## Load gaps from the Robinson Crusoe Island | ||
library(Lexiguel) | ||
data(rc_gaps) | ||
data(rc_gaps.env) | ||
|
||
## Calculation of curves | ||
rc_curves <- sloss(rc_gaps, rc_gaps.env, area) | ||
|
||
## Area calculated by function | ||
rc_curves$Index | ||
|
||
## Cross-check | ||
with(rc_curves$SL, curve_area(area, species))/with(rc_curves$LS, | ||
curve_area(area, species)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters