上一页 1 ··· 221 222 223 224 225 226 227 228 229 ··· 367 下一页
摘要: 1、全部替换 > c1 <- c("x", "z", "a", "b") > c2 <- c("a", "ab", "d", "z") > c3 <- c("d", "m", "n", "a") > c4 <- c("x", "a", "m", &qu 阅读全文
posted @ 2022-01-20 10:37 小鲨鱼2018 阅读(14120) 评论(0) 推荐(0) 编辑
摘要: 1、 > dat1 <- 1:8 > dat2 <- 3:10 > setdiff(dat1, dat2) ## 取数据dat1中的唯一项 [1] 1 2 > setdiff(dat2, dat1) ## 取数据dat2中的唯一项 [1] 9 10 2、如果有重复 > dat1 <- c(2, 1, 阅读全文
posted @ 2022-01-19 23:09 小鲨鱼2018 阅读(717) 评论(0) 推荐(0) 编辑
摘要: 1、测试数值 > dat1 <- 1:8 > dat2 <- 3:10 > intersect(dat1, dat2) ## 直接取两个数值型的交集 [1] 3 4 5 6 7 8 2、数值有重复的情况 > dat1 <- c(2, 3, 2, 4, 5, 3, 6, 3, 4, 8) > dat2 阅读全文
posted @ 2022-01-19 22:08 小鲨鱼2018 阅读(2814) 评论(0) 推荐(0) 编辑
摘要: R原因中list.files()函数用于列出指定目录下的特定文件。 1、查看当前目录下的所有文件 > dir() [1] "outcome.map" "ped.r" "result.map" "test1.r" "test2.r" "testxx.abcr" > list.files() [1] " 阅读全文
posted @ 2022-01-19 20:32 小鲨鱼2018 阅读(4752) 评论(0) 推荐(0) 编辑
摘要: 直方图: 直观地反映数据在不同区间的频数/频率分布。 1、 > dat <- c(rep(1,10), rep(2,5), rep(3,6)) ## 测试数据 > dat [1] 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 3 > hist(dat) ## 直接绘 阅读全文
posted @ 2022-01-18 21:09 小鲨鱼2018 阅读(1372) 评论(0) 推荐(0) 编辑
摘要: 1、一般绘图 > plot(0:10) 2、利用mfrow参数设置 par(mfrow = c(1,2)) ## 设置为一行两列 plot(0:10) plot(0:10) > dev.off() ## 清空设置 null device 1 > par(mfrow = c(1,4)) ## 设置为1 阅读全文
posted @ 2022-01-18 20:41 小鲨鱼2018 阅读(250) 评论(0) 推荐(0) 编辑
摘要: 1、查看默认值 > getOption("digits") [1] 7 ## 默认显示是7位 2、测试 > a = 1.12345 > a ## a为6位,正常显示 [1] 1.12345 > a = 1.123456 > a ## a为7位, 正常显示 [1] 1.123456 > a = 1.1 阅读全文
posted @ 2022-01-18 18:27 小鲨鱼2018 阅读(583) 评论(0) 推荐(0) 编辑
摘要: 1、问题 > dis <- seq(100000, 10000000, 100000) > head(dis) ## 为什么以科学计数法显示? [1] 1e+05 2e+05 3e+05 4e+05 5e+05 6e+05 2、测试 > a = 10000 > a [1] 10000 > a = 1 阅读全文
posted @ 2022-01-17 23:52 小鲨鱼2018 阅读(4309) 评论(0) 推荐(0) 编辑
摘要: 1、 root@PC1:/home/test# ls test.sh root@PC1:/home/test# cat test.sh #!/bin/bash #using a function in a script function func1 { ## shell自定义函数的格式之一是 fun 阅读全文
posted @ 2022-01-16 13:18 小鲨鱼2018 阅读(182) 评论(0) 推荐(0) 编辑
摘要: 1、 root@PC1:/home/test# ls root@PC1:/home/test# for i in {A..D}; do for j in {A..D}; do echo $i"_"$j; done; done ## 生成A-D任意的两两组合 A_A A_B A_C A_D B_A B 阅读全文
posted @ 2022-01-15 16:56 小鲨鱼2018 阅读(298) 评论(0) 推荐(0) 编辑
上一页 1 ··· 221 222 223 224 225 226 227 228 229 ··· 367 下一页