上一页 1 ··· 292 293 294 295 296 297 298 299 300 ··· 367 下一页
摘要: 1、测试1 a <- c(3,7,4,1) order(a) ## 返回从小到大排序的索引 rank(a) ## 返回元素从小到大的排名 sort(a) ## 直接对元素从小到大排序 阅读全文
posted @ 2021-04-23 10:58 小鲨鱼2018 阅读(713) 评论(0) 推荐(0) 编辑
摘要: 1、判断数据类型 a <- 1:4 class(a) is.numeric(a) is.vector(a) is.character(a) is.logical(a) is.array(a) is.data.frame(a) is.matrix(a) is.factor(a) 2、转换数据类型 a 阅读全文
posted @ 2021-04-23 10:45 小鲨鱼2018 阅读(4318) 评论(0) 推荐(0) 编辑
摘要: 1、字符串转换为日期 x <- c("3/5/2004","5/2/2008") y <- as.Date(x,"%m/%d/%Y") y class(y) 2、获取当前日期 Sys.Date() date() 3、日期计算差值 a <- as.Date("2021-03-30") b <- as. 阅读全文
posted @ 2021-04-23 10:35 小鲨鱼2018 阅读(133) 评论(0) 推荐(0) 编辑
摘要: 1、查看缺失值 > x <- c(3,1,NA,NA) > x <- c(3,1,NA,NA) > y <- c(3,4,2,7) > z <- c(3,2,5,1) > da <- data.frame(x,y,z) > da x y z 1 3 3 3 2 1 4 2 3 NA 2 5 4 NA 阅读全文
posted @ 2021-04-23 09:19 小鲨鱼2018 阅读(870) 评论(0) 推荐(0) 编辑
摘要: 1、测试1 [root@centos7 test2]# i=0 [root@centos7 test2]# max=5 [root@centos7 test2]# while((i<max));do echo $i;((i++));done 0 1 2 3 4 阅读全文
posted @ 2021-04-22 18:47 小鲨鱼2018 阅读(71) 评论(0) 推荐(0) 编辑
摘要: 1、测试1 [root@centos7 test2]# for ((i=1; i<=5; i++)); do echo "100"; done 100 100 100 100 100 阅读全文
posted @ 2021-04-22 18:45 小鲨鱼2018 阅读(59) 评论(0) 推荐(0) 编辑
摘要: 1、测试1 [root@centos7 test2]# cat test.sh #!/bin/bash read -p "please input an character: " i case $i in [a-z]|[A-Z]) echo "letter!" ;; [0-9]) echo "num 阅读全文
posted @ 2021-04-22 17:07 小鲨鱼2018 阅读(705) 评论(0) 推荐(0) 编辑
摘要: 1、隐藏光标 echo -e "\033[?25l" 2、显示光标 echo -e "\033[?25h" 来源:https://blog.csdn.net/weixin_43336281/article/details/99109789 阅读全文
posted @ 2021-04-22 16:19 小鲨鱼2018 阅读(350) 评论(0) 推荐(0) 编辑
摘要: 1、测试1 求1-100的和 [root@centos7 test2]# cat test.sh #!/bin/bash sum=0 a=1 while [ $a -le 100 ] do let sum+=$a let a++ done echo "the sum of 1-100 is: $su 阅读全文
posted @ 2021-04-22 15:51 小鲨鱼2018 阅读(1261) 评论(0) 推荐(0) 编辑
摘要: 1、for语句 [root@centos7 test2]# cat test.sh #!/bin/bash sum=0 for i in `seq $1` do let sum+=$i done echo "the sum of 1-$1 is: $sum" [root@centos7 test2] 阅读全文
posted @ 2021-04-22 13:05 小鲨鱼2018 阅读(3759) 评论(0) 推荐(0) 编辑
上一页 1 ··· 292 293 294 295 296 297 298 299 300 ··· 367 下一页