当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


R Skye Aphyric Skye Lavas 的 AFM 成分


R语言 Skye 位于 MASS 包(package)。

说明

Skye 数据帧有 23 行和 3 列。

用法

Skye

格式

该 DataFrame 包含以下列:

A

钠和钾氧化物的百分比。

F

氧化铁的百分比。

M

氧化镁的百分比。

例子

# ternary() is from the on-line answers.
ternary <- function(X, pch = par("pch"), lcex = 1,
                    add = FALSE, ord = 1:3, ...)
{
  X <- as.matrix(X)
  if(any(X < 0)) stop("X must be non-negative")
  s <- drop(X %*% rep(1, ncol(X)))
  if(any(s<=0)) stop("each row of X must have a positive sum")
  if(max(abs(s-1)) > 1e-6) {
    warning("row(s) of X will be rescaled")
    X <- X / s
  }
  X <- X[, ord]
  s3 <- sqrt(1/3)
  if(!add)
  {
    oldpty <- par("pty")
    on.exit(par(pty=oldpty))
    par(pty="s")
    plot(c(-s3, s3), c(0.5-s3, 0.5+s3), type="n", axes=FALSE,
         xlab="", ylab="")
    polygon(c(0, -s3, s3), c(1, 0, 0), density=0)
    lab <- NULL
    if(!is.null(dn <- dimnames(X))) lab <- dn[[2]]
    if(length(lab) < 3) lab <- as.character(1:3)
    eps <- 0.05 * lcex
    text(c(0, s3+eps*0.7, -s3-eps*0.7),
         c(1+eps, -0.1*eps, -0.1*eps), lab, cex=lcex)
  }
  points((X[,2] - X[,3])*s3, X[,1], ...)
}

ternary(Skye/100, ord=c(1,3,2))

来源

R. N. Thompson、J. Esson 和 A. C. Duncan (1972) 斯凯岛始新世熔岩中的主要元素化学变化。岩石学杂志,13, 219-253。

参考

J. Aitchison (1986) The Statistical Analysis of Compositional Data. Chapman and Hall, p.360.

Venables, W. N. and Ripley, B. D. (2002) Modern Applied Statistics with S. Fourth edition. Springer.

相关用法


注:本文由纯净天空筛选整理自R-devel大神的英文原创作品 AFM Compositions of Aphyric Skye Lavas。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。