上一页 1 ··· 220 221 222 223 224 225 226 227 228 ··· 367 下一页
摘要: 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) 编辑
摘要: 1、 root@PC1:/home/test2# ls a.txt dir.1 test.csv test.ped root@PC1:/home/test2# ls -l total 8 -rw-r--r-- 1 root root 64 1月 21 23:14 a.txt drwxr-xr-x 2 阅读全文
posted @ 2022-01-21 23:45 小鲨鱼2018 阅读(401) 评论(0) 推荐(0) 编辑
摘要: 1、测试数据 root@PC1:/home/test2# ls a.txt root@PC1:/home/test2# cat a.txt ## 测试数据 chenwu 05/99 4811 27 mary 02/22 1231 30 tom 09/15 1182 25 2、 root@PC1:/h 阅读全文
posted @ 2022-01-21 23:34 小鲨鱼2018 阅读(673) 评论(0) 推荐(0) 编辑
摘要: 1、测试数据 root@PC1:/home/test# ls ## 测试数据 a.txt b.txt root@PC1:/home/test# cat a.txt w s g d w a root@PC1:/home/test# cat b.txt d a e d t c 2、取两个文件的交集 so 阅读全文
posted @ 2022-01-21 18:44 小鲨鱼2018 阅读(202) 评论(0) 推荐(0) 编辑
摘要: 1、 root@PC1:/home/test# ls test.txt root@PC1:/home/test# cat test.txt 1 3 8 1 3 5 1 7 root@PC1:/home/test# sort test.txt | uniq -d ## 取出重复项 1 3 root@P 阅读全文
posted @ 2022-01-21 15:36 小鲨鱼2018 阅读(207) 评论(0) 推荐(0) 编辑
摘要: 1、 > dat1 <- c(1, 2, 3, 4, 5, 6) ## 测试数据 > dat2 <- c(1, 2, 3, 4, 5, 6) ## 测试数据 > lm(dat2~dat1) Call: lm(formula = dat2 ~ dat1) Coefficients: (Intercep 阅读全文
posted @ 2022-01-21 12:29 小鲨鱼2018 阅读(451) 评论(0) 推荐(0) 编辑
摘要: R语言caret包中createFolds函数实现将向量随机分组。 1、 > library(caret) > createFolds(1:10, k = 5) ## 将1-10随机分为5组,返回每组的索引 $Fold1 [1] 4 5 $Fold2 [1] 1 3 $Fold3 [1] 2 7 $ 阅读全文
posted @ 2022-01-20 23:20 小鲨鱼2018 阅读(1817) 评论(0) 推荐(0) 编辑
摘要: R语言中set.seed函数的作用是保证两次随机抽样的结果一致。 1、不使用set.seed函数的情况下 > sample(1:8, 3) ## 从1~8中随机抽取3个数字 [1] 3 7 4 > sample(1:8, 3) [1] 4 8 6 > sample(1:8, 3) [1] 1 5 4 阅读全文
posted @ 2022-01-20 22:55 小鲨鱼2018 阅读(1377) 评论(0) 推荐(0) 编辑
上一页 1 ··· 220 221 222 223 224 225 226 227 228 ··· 367 下一页