上一页 1 ··· 275 276 277 278 279 280 281 282 283 ··· 408 下一页
摘要: 1、R实现 dat <- read.table("outcome.ped") name1 <- c("FID", "IID", "PAT", "MAT","SEX", "PHENOTYPE" ) name2 <- dat[,1:6] name3 <- rbind(name1, name2) dat 阅读全文
posted @ 2021-11-02 21:52 小鲨鱼2018 阅读(882) 评论(0) 推荐(0)
摘要: 1、测试数据 root@PC1:/home/test/test/test2# cat nuc.ped G G C C G G G G A G A A G G G C G G G G G G A A G G C C G G G G G G A A G G C C G G G G G G A A G G 阅读全文
posted @ 2021-11-02 21:39 小鲨鱼2018 阅读(207) 评论(0) 推荐(0)
摘要: 1、测试数据 root@PC1:/home/test2# cat a.txt 1 e d 2 a g 3 w e 4 d g 5 g j 6 e j 7 l m 8 i n 2、awk命令实现 root@PC1:/home/test2# cat a.txt 1 e d 2 a g 3 w e 4 d 阅读全文
posted @ 2021-11-02 20:35 小鲨鱼2018 阅读(422) 评论(0) 推荐(0)
摘要: 1、测试数据 root@PC1:/home/test2# ls a.txt root@PC1:/home/test2# cat a.txt 1 2 3 4 5 6 7 8 e a w d g e l i d g e g j j m n 2、将连续的两列数据转换成一列数据 root@PC1:/home 阅读全文
posted @ 2021-11-02 20:24 小鲨鱼2018 阅读(215) 评论(0) 推荐(0)
摘要: set.seed()用于保证多次生成随机数的结果一致。 1、 par(mfrow = c(2,2)) a <- rnorm(10) plot(a, pch = 19, cex =2) b <- rnorm(10) plot(b, pch = 19, cex =2) set.seed(100) c < 阅读全文
posted @ 2021-11-02 20:03 小鲨鱼2018 阅读(973) 评论(0) 推荐(0)
摘要: 1、统计每行中特定字符出现的次数 root@PC1:/home/test/test# cat a.txt w d t i d g e d t c d t j k j j k k k j root@PC1:/home/test/test# awk '{print gsub(/d/,"&")}' a.t 阅读全文
posted @ 2021-11-02 18:51 小鲨鱼2018 阅读(4137) 评论(0) 推荐(0)
摘要: 1、测试数据 root@PC1:/home/test/test# cat a.txt w d t d g e t c d root@PC1:/home/test/test# awk -v RS="@#$j" '{print gsub(/d/,"&")}' a.txt ##RS是输出分割符,定义特殊分 阅读全文
posted @ 2021-11-02 18:44 小鲨鱼2018 阅读(1220) 评论(0) 推荐(0)
摘要: 1、 result1 <- data.frame(1:100) for (i in 1:10) { temp1 <- sample(c("A", "C", "G", "T"), 2, replace = F) temp2 <- sample(c(temp1[1], temp1[2]), 100, r 阅读全文
posted @ 2021-11-01 22:46 小鲨鱼2018 阅读(182) 评论(0) 推荐(0)
摘要: R语言中apply函数,可以实现批量对矩阵、数据框的行或者列进行各种处理。 apply的第一个参数指定操作对象, 第二个参数指定对行还是列进行操作, 第三个参数指定操作类型 1、示例1 a1 <- c(4,2,1,6) a2 <- c(3,2,3,6) a3 <- c(2,1,4,8) dat <- 阅读全文
posted @ 2021-11-01 10:54 小鲨鱼2018 阅读(1304) 评论(0) 推荐(0)
摘要: R语言中rnorm函数用于产生服从正态分布的随机数。(r:random, norm: normal) 1、直接使用,默认产生平均数为0,标准差为1的随机数。 dat <- rnorm(30) dat mean(dat) sd(dat) 2、可以设定平均数 dat <- rnorm(30,5) ## 阅读全文
posted @ 2021-11-01 10:26 小鲨鱼2018 阅读(8067) 评论(0) 推荐(0)
上一页 1 ··· 275 276 277 278 279 280 281 282 283 ··· 408 下一页