摘要: 1、随机抽样 > a <- 1:10 > sample(a,5) [1] 9 4 5 10 6 > sample(a,5,replace = T) [1] 10 7 5 3 4 > sample(a,5,replace = T) ## 有放回抽样 [1] 5 9 5 1 3 > b <- LETTE 阅读全文
posted @ 2021-04-15 22:24 小鲨鱼2018 阅读(2289) 评论(0) 推荐(0) 编辑
摘要: 1、和 [root@centos7 test]# cat a.txt 3 8 9 4 2 4 8 1 9 8 4 2 8 5 3 2 [root@centos7 test]# sed -n '1p' a.txt 3 8 9 4 [root@centos7 test]# sed -n '1p' a.t 阅读全文
posted @ 2021-04-15 22:06 小鲨鱼2018 阅读(994) 评论(0) 推荐(0) 编辑
摘要: 1、最大值 [root@centos7 test]# cat a.txt 4 2 8 6 4 9 2 7 5 3 5 7 [root@centos7 test]# awk 'BEGIN{max = 0}{if($1 > max) max = $1}END{print max}' a.txt 6 [r 阅读全文
posted @ 2021-04-15 21:53 小鲨鱼2018 阅读(5050) 评论(0) 推荐(0) 编辑
摘要: 1、交集intersect > x <- 1:4 > y <- 3:7 > x [1] 1 2 3 4 > y [1] 3 4 5 6 7 > intersect(x,y) [1] 3 4 2、并集union > x <- 1:4 > y <- 3:7 > x [1] 1 2 3 4 > y [1] 阅读全文
posted @ 2021-04-15 20:38 小鲨鱼2018 阅读(941) 评论(0) 推荐(0) 编辑
摘要: 1、简单用法 > a <- c(5:2,3:7,4+1:4) > a [1] 5 4 3 2 3 4 5 6 7 5 6 7 8 > unique(a) ## 去重复 [1] 5 4 3 2 6 7 8 2、数据框 > a <- rep(1, 5) > b <- c(4,3,2,2,4) > c < 阅读全文
posted @ 2021-04-15 19:09 小鲨鱼2018 阅读(3301) 评论(0) 推荐(0) 编辑
摘要: 1、按行排列 [root@centos7 test]# cat a.txt 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 [root@centos7 test]# cat a.txt | xargs -n 4 01 02 03 阅读全文
posted @ 2021-04-15 18:37 小鲨鱼2018 阅读(455) 评论(0) 推荐(0) 编辑
摘要: 1、 [root@centos7 test]# cat a.txt 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 阅读全文
posted @ 2021-04-15 17:28 小鲨鱼2018 阅读(1252) 评论(0) 推荐(0) 编辑
摘要: 1、测试数据 [root@centos7 test]# cat a.txt e d g e s d g w a x d g n d i d 2、 [root@centos7 test]# cat a.txt e d g e s d g w a x d g n d i d [root@centos7 阅读全文
posted @ 2021-04-15 14:36 小鲨鱼2018 阅读(264) 评论(0) 推荐(0) 编辑
摘要: 1、测试数据 [root@centos7 test2]# cat a.txt e d g e d w i s d g w e i d a x d g i w e n d i d o e w 2、提取1-3列,1-5列 [root@centos7 test2]# cat a.txt e d g e d 阅读全文
posted @ 2021-04-15 11:57 小鲨鱼2018 阅读(2834) 评论(0) 推荐(0) 编辑
摘要: 1、测试数据 [root@centos7 test2]# cat a.txt e d g e s d g w a x d g n d i d 2、将第三列替换为xxx [root@centos7 test2]# cat a.txt e d g e s d g w a x d g n d i d [r 阅读全文
posted @ 2021-04-15 11:03 小鲨鱼2018 阅读(4670) 评论(0) 推荐(0) 编辑
摘要: 1、测试数据 [root@centos7 test2]# cat a.txt e d g e s d g w a x d g n d i d [root@centos7 test2]# cat a.txt | sed -n l e d g e$ s d g w$ a x d g$ n d i d$ 阅读全文
posted @ 2021-04-15 10:57 小鲨鱼2018 阅读(2171) 评论(0) 推荐(0) 编辑
摘要: 1、测试数据 [root@centos7 test2]# ll -h total 1.4G -rw-r--r--. 1 root root 41M Apr 15 09:47 a.map -rw-r--r--. 1 root root 204M Apr 15 09:47 a.ped -rw-r--r- 阅读全文
posted @ 2021-04-15 10:03 小鲨鱼2018 阅读(1130) 评论(0) 推荐(0) 编辑
摘要: 1、测试数据 [root@centos7 test2]# ls a.map a.ped b.map b.ped c.ped result.map [root@centos7 test2]# ll -h total 1.4G -rw-r--r--. 1 root root 41M Apr 15 09: 阅读全文
posted @ 2021-04-15 09:57 小鲨鱼2018 阅读(1268) 评论(0) 推荐(1) 编辑
摘要: 1、创建测试数据 [root@centos7 test2]# cat > a.txt i s g z e q d k i p m h y u t e ^C [root@centos7 test2]# ls a.txt [root@centos7 test2]# cat a.txt i s g z e 阅读全文
posted @ 2021-04-15 09:44 小鲨鱼2018 阅读(874) 评论(0) 推荐(0) 编辑
摘要: 1、创建测试数据 [root@centos7 test2]# touch a.txt b.txt c.txt; mkdir test01 test02 test03 [root@centos7 test2]# ls a.txt b.txt c.txt test01 test02 test03 2、删 阅读全文
posted @ 2021-04-15 09:23 小鲨鱼2018 阅读(974) 评论(0) 推荐(0) 编辑
摘要: 1、创建测试数据 [root@centos7 test2]# touch {1..9}.txt [root@centos7 test2]# ls 1.txt 2.txt 3.txt 4.txt 5.txt 6.txt 7.txt 8.txt 9.txt 2、删除3.txt、7.txt外的其他文件 [ 阅读全文
posted @ 2021-04-15 09:05 小鲨鱼2018 阅读(329) 评论(0) 推荐(0) 编辑