上一页 1 ··· 199 200 201 202 203 204 205 206 207 ··· 367 下一页
摘要: 1、 测试数据 > df <- data.frame(Age=c(22,24,25,26), Gender=c("Girl","Girl","Boy","Boy"), + City=c("Shanghai","Beijing","Guangzhou","Nanjing")) > df Age Gen 阅读全文
posted @ 2022-04-29 21:55 小鲨鱼2018 阅读(1064) 评论(0) 推荐(0) 编辑
摘要: 1、测试数据 > dat <- as.data.frame(matrix(1:100, nrow = 10)) > colnames(dat) <- 1:10 > rownames(dat) <- 1:10 > dat 1 2 3 4 5 6 7 8 9 10 1 1 11 21 31 41 51 阅读全文
posted @ 2022-04-29 21:47 小鲨鱼2018 阅读(3681) 评论(0) 推荐(0) 编辑
摘要: 1、方法1 模拟200个样本, 50000个位点 nsnp <- 50000 nind <- 200 nums <- sample(1:2, nsnp * 2 * nind, replace = T) snp_matrix <- matrix(nums, nrow = 200) col_idx <- 阅读全文
posted @ 2022-04-29 18:20 小鲨鱼2018 阅读(236) 评论(0) 推荐(0) 编辑
摘要: 1、R安装devtools过程中遇到如下问题: > install.packages('devtools', repos='https://mirror.lzu.edu.cn/CRAN/') 2、解决方法 sudo apt-get install libssl-dev sudo apt-get in 阅读全文
posted @ 2022-04-29 10:40 小鲨鱼2018 阅读(645) 评论(0) 推荐(0) 编辑
摘要: 1、 > a <- letters[1:10] > a [1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" > replace(a, c(1, 3, 5), "xxx") ## 替换指定索引的字符串为特定的字符串 [1] "xxx" "b" "xxx" &qu 阅读全文
posted @ 2022-04-29 00:20 小鲨鱼2018 阅读(1028) 评论(0) 推荐(0) 编辑
摘要: 1、 root@DESKTOP-1N42TVH:/home/test2# ls a.txt test.r root@DESKTOP-1N42TVH:/home/test2# cat test.r #!/usr/bin/Rscript library(optparse) option_list <- 阅读全文
posted @ 2022-04-28 23:20 小鲨鱼2018 阅读(321) 评论(0) 推荐(0) 编辑
摘要: 1、 root@DESKTOP-1N42TVH:/home/test2# ls test.r root@DESKTOP-1N42TVH:/home/test2# cat test.r ## 测试函数 argv <- commandArgs(TRUE) ## 参数收集在argv数组中 print(pa 阅读全文
posted @ 2022-04-28 22:38 小鲨鱼2018 阅读(273) 评论(0) 推荐(0) 编辑
摘要: ubuntu安装R遇到如下问题: root@DESKTOP-1N42TVH:/home/test2# apt install r-base-core 1、系统内核 root@DESKTOP-1N42TVH:/home/test2# lsb_release -a No LSB modules are 阅读全文
posted @ 2022-04-28 22:01 小鲨鱼2018 阅读(2057) 评论(0) 推荐(0) 编辑
摘要: 1、自定义函数之位置参数 > testfun1 <- function(arg1, arg2){ ## 自定义函数,给与两个参数arg1、arg2 + result = arg1 - arg2 + print(result) + } > testfun1(10, 3) ## 默认就是位置参数,即ar 阅读全文
posted @ 2022-04-28 20:25 小鲨鱼2018 阅读(1434) 评论(0) 推荐(0) 编辑
摘要: 001、 > a <- c("abc", "bcd", "ead") > b <- c("ead", "aya", "dbe") > c <- c("mna", "ond", "dne") > d <- data.frame(a, b, c) > d a b c 1 abc ead mna 2 bc 阅读全文
posted @ 2022-04-28 19:55 小鲨鱼2018 阅读(4481) 评论(0) 推荐(0) 编辑
上一页 1 ··· 199 200 201 202 203 204 205 206 207 ··· 367 下一页