找回密码
 注册
查看: 491|回复: 0

R语言 IRanges包 isConstant()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-2-25 22:28:58 | 显示全部楼层 |阅读模式
isConstant(IRanges)
isConstant()所属R语言包:IRanges

                                        Test if an atomic vector or array is constant
                                         测试如果一个原子的向量或阵列是不变的

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

Generic function to test if an atomic vector or array is constant or not. Currently only methods for vectors or arrays of type integer or double are implemented.
通用功能测试,如果一个原子的向量或数组常数或。目前唯一的方法为向量或数组类型的整数或双的贯彻落实。


用法----------Usage----------


isConstant(x)



参数----------Arguments----------

参数:x
An atomic vector or array.  
一个原子的向量或数组。


Details

详情----------Details----------

Vectors of length 0 or 1 are always considered to be constant.
长度为0或1的向量总是被认为是恒定的。


值----------Value----------

A single logical i.e. TRUE, FALSE or NA.
一个单一的逻辑,即TRUE,FALSE或NA。


作者(S)----------Author(s)----------


H. Pages



参见----------See Also----------

duplicated, unique, all.equal, NA, is.finite
duplicated,unique,all.equal,NA,is.finite


举例----------Examples----------


  ## ---------------------------------------------------------------------[#------------------------------------------------- --------------------]
  ## A. METHOD FOR integer VECTORS[#答:对于整数向量的方法]
  ## ---------------------------------------------------------------------[#------------------------------------------------- --------------------]

  ## On a vector with no NAs:[#在一个没有NAS的向量:]
  stopifnot(isConstant(rep(-29L, 10000)))

  ## On a vector with NAs:[#在与NAS的向量:]
  stopifnot(!isConstant(c(0L, NA, -29L)))
  stopifnot(is.na(isConstant(c(-29L, -29L, NA))))

  ## On a vector of length &lt;= 1:[#长度<= 1的向量:]
  stopifnot(isConstant(NA_integer_))


  ## ---------------------------------------------------------------------[#------------------------------------------------- --------------------]
  ## B. METHOD FOR numeric VECTORS[#B.方法数值向量]
  ## ---------------------------------------------------------------------[#------------------------------------------------- --------------------]
  ## This method does its best to handle rounding errors and special[#此方法确实尽力处理舍入误差和特殊]
  ## values NA, NaN, Inf and -Inf in a way that "makes sense".[#值NA大,NaN,Inf和-INF“有意义”的方式。]
  ## Below we only illustrate handling of rounding errors.[#下面我们只说明舍入误差的处理。]

  ## Here values in 'x' are "conceptually" the same:[X#这里的值是“概念”一样:]
  x <- c(11/3,
         2/3 + 4/3 + 5/3,
         50 + 11/3 - 50,
         7.00001 - 1000003/300000)
  ## However, due to machine rounding errors, they are not *strictly*[#然而,由于机四舍五入的错误,他们没有严格*]
  ## equal:[#等于:]
  duplicated(x)
  unique(x)
  ## only *nearly* equal:[#只*近*相等于:]
  all.equal(x, rep(11/3, 4))  # TRUE[真]

  ## 'isConstant(x)' uses 'all.equal()' internally to decide whether[#isConstant(X)“内部使用”all.equal()决定是否]
  ## the values in 'x' are all the same or not:[#X的值是所有相同或不]
  stopifnot(isConstant(x))

  ## This is not perfect though:[#这是不完美的:]
  isConstant((x - 11/3) * 1e8)  # FALSE on Intel Pentium paltforms[FALSE,在英特尔奔腾paltforms]
                                # (but this is highly machine dependent!)[(但这是高度依赖于机器!)]

转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2025-2-5 16:37 , Processed in 0.021314 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表