1.R中NA,NaN,Inf代表什么?

NA:缺失数据

NaN:无意义的数,比如sqrt(-2)

Inf:正无穷大

-Inf:负无穷大

2.确定一个数值型vector的第一个最值(最大/最小)的下标:

which.min(x)
which.max(x) x
numeric (logical, integer or double) vector or an R object for which the internal coercion to double works whose min or max is searched for.

3.对应的,确定一个矩阵每一行最值的下标:

max.col(m, ties.method = c("random", "first", "last"))
m
numerical matrix ties.method
a character string specifying how ties are handled, "random" by default;

通常第一个参数默认是random,如果是first那么就返回相同最大值中第一列,last与此相反。

4.判断一个逻辑向量中,值为TRUE的下标:

which(x, arr.ind = FALSE, useNames = TRUE)
arrayInd(ind, .dim, .dimnames = NULL, useNames = FALSE)
which(LETTERS == "R")
which(ll <- c(TRUE, FALSE, TRUE, NA, FALSE, FALSE, TRUE)) #>

转自:https://stat.ethz.ch/R-manual/R-devel/library/base/html/which.html

5.返回输入值中的最大值和最小值

转自:https://stat.ethz.ch/R-manual/R-devel/library/base/html/Extremes.html

max(..., na.rm = FALSE)
min(..., na.rm = FALSE) pmax(..., na.rm = FALSE)
pmin(..., na.rm = FALSE) pmax.int(..., na.rm = FALSE)
pmin.int(..., na.rm = FALSE) ...
numeric or character arguments (see Note). na.rm
a logical indicating whether missing values should be removed.
用法:
min(:, pi) #-> one number
pmin(:, pi) #-> numbers

最新文章

  1. linux命令crontab
  2. POJ 2240 - Arbitrage(bellman_ford &amp; floyd)
  3. DIV CSS 网页兼容全搞定 (IE6 IE7 IE8 IE9 火狐 谷歌)
  4. robotframework笔记5
  5. SQL中 char、varchar、text 和 nchar、nvarchar、ntext的区别
  6. bzoj 1419 Red is good(期望DP)
  7. How to open MS word document from the SharePoint 2010 using Microsoft.Office.Interop.dll
  8. jQuery EasyUI, datagrid, treegrid formatter 参数比较 row index
  9. TableView基本使用
  10. javascript数组去重算法-----2
  11. 59 pages的Delphi源码
  12. Oracle ASM数据库故障数据恢复过程
  13. java爬虫,爬取当当网数据
  14. .net core webapi 后台获取客户端ip地址
  15. java.lang.Object.wait(Native Method)
  16. Win10系列:VC++媒体播放控制4
  17. threejs和3d各种效果的学习
  18. Swift Tips笔记
  19. 装饰模式和Java IO
  20. 第一章 关于html适应手机屏幕的写法

热门文章

  1. 后缀数组LCP + 二分 - UVa 11107 Life Forms
  2. 具有全球唯一性,相对于internet,IP为逻辑地址
  3. php -- 设计模式 之 单例模式
  4. ThinkPHP项目笔记之控制器常用语法
  5. hdu 2025:查找最大元素(水题,顺序查找)
  6. 怎么用ChemDraw连接两个结构片段
  7. Python爬虫(七)
  8. iOS开发之 -- 帧动画的使用
  9. iOS开发之-- 抢购、距活动结束,剩余时间倒计时
  10. 了解 IMyInterface.Stub