摘要: 1、R语言seq函数用于生成一段步长相等的序列 简单用法: > seq(5) ##默认从1开始,默认步长为1,只跟一个数字默认是终点 [1] 1 2 3 4 5 > seq(6) [1] 1 2 3 4 5 6 > seq(5.6) [1] 1 2 3 4 5 2、设定起点 > seq(5) [1] 阅读全文
posted @ 2020-10-06 19:57 小鲨鱼2018 阅读(9671) 评论(0) 推荐(1) 编辑
摘要: 1、创建测试数据 利用awk进行合并(1) [root@linuxprobe test2]# seq -w 30 | xargs -n 2 | sed = | sed 'N;s/\n/> /' > a.txt ##创建测试数据 [root@linuxprobe test2]# cat a.txt 1 阅读全文
posted @ 2020-10-06 15:34 小鲨鱼2018 阅读(992) 评论(0) 推荐(0) 编辑
摘要: 1、利用xargs命令将多列数据转化为一列数据 [root@linuxprobe test2]# echo "1 2 3 4 5 6" > a.txt [root@linuxprobe test2]# cat a.txt 1 2 3 4 5 6 [root@linuxprobe test2]# ca 阅读全文
posted @ 2020-10-06 14:57 小鲨鱼2018 阅读(2047) 评论(0) 推荐(0) 编辑
摘要: 1、利用xargs进行行列转换 [root@linuxprobe test2]# seq 512345[root@linuxprobe test2]# seq 5 | xargs ## xargs 默认转化为1行1 2 3 4 5[root@linuxprobe test2]# seq 5000 | 阅读全文
posted @ 2020-10-06 13:54 小鲨鱼2018 阅读(2417) 评论(0) 推荐(0) 编辑
摘要: 1、R语言中sort函数对向量按照从小到大排序,默认返回向量从小到大的值 创建测试数据: > test <- c(7,1,9,3,8)> test[1] 7 1 9 3 8> a <- sort(test) ## 默认升序> class(a) ## 返回值为数值[1] "numeric"> a[1] 阅读全文
posted @ 2020-10-06 00:10 小鲨鱼2018 阅读(10879) 评论(0) 推荐(0) 编辑