摘要: 1、sqrt > sqrt(4) ## 4的平方根 [1] 2 > sqrt(9) ## 9的平方根 [1] 3 > sqrt(10) ## 10的平方根 [1] 3.162278 2、log > log(100) ## 以e为底, 100的对数 [1] 4.60517 > log10(100) # 阅读全文
posted @ 2022-01-23 23:29 小鲨鱼2018 阅读(1932) 评论(0) 推荐(0) 编辑
摘要: 1、向下取整数floor > a <- 1.1 ## 向下取整数 > floor(a) [1] 1 > a <- 1.9 ## 向下取整数 > floor(a) [1] 1 2、向上取整数ceiling > a <- 1.9 > ceiling(a) ## 向上取整数 [1] 2 > a <- 1. 阅读全文
posted @ 2022-01-23 23:23 小鲨鱼2018 阅读(1094) 评论(0) 推荐(0) 编辑
摘要: 1、取正对角线 root@PC1:/home/test# ls a.txt root@PC1:/home/test# cat a.txt 1 D E 2 s d 3 d c root@PC1:/home/test# awk '{print $NR}' a.txt ## 取矩阵对角线元素,正对角线 1 阅读全文
posted @ 2022-01-23 21:40 小鲨鱼2018 阅读(82) 评论(0) 推荐(0) 编辑