会员
周边
新闻
博问
闪存
众包
赞助商
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
小鲨鱼2018
博客园
首页
新随笔
联系
订阅
管理
上一页
1
···
182
183
184
185
186
187
188
189
190
···
408
下一页
2022年8月23日
R语言中根据每一列中的若干分类提取数据
摘要: 001、 library(dplyr) dat <- read.table("xx.map", header = F) ## 测试数据 dat dat %>% group_by(V1) %>% top_n(n = 2, wt = V2) ## 以第一列分类, 然后按照第二列从大到小排序,并提取前两个
阅读全文
posted @ 2022-08-23 19:59 小鲨鱼2018
阅读(772)
评论(0)
推荐(0)
2022年8月22日
R语言中因子型转换为数值型
摘要: 001、 test <- as.factor(c(2, 3, 7, 8)) test as.numeric(test) ## 不能直接将因子型转换为数值型 as.numeric(as.character(test)) ## 先转换为字符,然后转换为数值
阅读全文
posted @ 2022-08-22 23:09 小鲨鱼2018
阅读(378)
评论(0)
推荐(0)
2022年8月21日
R语言中如何将矩阵的元素全部设置为0, 取矩阵的最大值、最小值、平均值
摘要: 001、 dat3 <- matrix(1:16, nrow = 4, byrow = T) dat3 min(dat3) mean(dat3) max(dat3) dat3[] <- 0 ## 将矩阵元素全部设置为0(可以为任意元素) dat3
阅读全文
posted @ 2022-08-21 23:48 小鲨鱼2018
阅读(487)
评论(0)
推荐(0)
linux 中sed命令如何删除第一列和最后一列
摘要: 001、删除第一列 (base) root@PC1:/home/test# cat test.txt 1 MIR1302-10 1 2 FAM138A 2 3 OR4F5 3 4 RP11-34P13.7 4 5 RP11-34P13.8 5 6 AL627309.1 6 7 RP11-34P13.
阅读全文
posted @ 2022-08-21 23:28 小鲨鱼2018
阅读(1721)
评论(0)
推荐(0)
2022年8月20日
python 中生成列表矩阵
摘要: 001、 >>> [[0] * 5 for i in range(3)] ## 生成3行5列,元素为0的矩阵 [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]] 002、 >>> [ [1, 2, 3] * 2 for i in range(6)]
阅读全文
posted @ 2022-08-20 01:38 小鲨鱼2018
阅读(339)
评论(0)
推荐(0)
python 中(序列)内置函数enumerate
摘要: pyhton 中内置函数enumerate用于将序列生成二元组。 001、 >>> str1 = "hello!" ## 测试字符串 >>> for i in enumerate(str1): ## enumerate用于将序列生成二元组 ... print(i) ... (0, 'h') (1,
阅读全文
posted @ 2022-08-20 01:18 小鲨鱼2018
阅读(54)
评论(0)
推荐(0)
python 中 判断列表、元组、字符串、字典、集合为空的方法
摘要: 001、 >>> test1 = [] >>> test1 [] >>> if not test1: ## 判断列表为空 ... print("no element") ... no element 002、 >>> test1 = () >>> test1 () >>> if not test1:
阅读全文
posted @ 2022-08-20 01:05 小鲨鱼2018
阅读(536)
评论(0)
推荐(0)
python中 pysam包FastxFile函数
摘要: 001、读取fasta文件 root@PC1:/home/test# ls a.fasta root@PC1:/home/test# cat a.fasta ## 测试数据 >Rosalind_1 ATCCAGCT >Rosalind_2 GGGCAACT >Rosalind_3 ATGGATCT
阅读全文
posted @ 2022-08-20 00:38 小鲨鱼2018
阅读(240)
评论(0)
推荐(0)
2022年8月19日
c语言中利用函数递归求阶乘
摘要: 001、 #include <stdio.h> int test(int n) // 定义函数 { if(n > 0) { return n * test(n - 1); // 调用函数自身, 终止条件是n = 0 } else { return 1; } } int main(void) { in
阅读全文
posted @ 2022-08-19 00:56 小鲨鱼2018
阅读(211)
评论(0)
推荐(0)
c语言中枚举类型
摘要: 001、 #include <stdio.h> enum set01 {aaa, bbb, ccc, ddd}; // 表示一定整数值的集合的枚举类型。0, 1, 2, 3 int main(void) { printf("aaa: %d\n", aaa); printf("bbb: %d\n",
阅读全文
posted @ 2022-08-19 00:20 小鲨鱼2018
阅读(46)
评论(0)
推荐(0)
上一页
1
···
182
183
184
185
186
187
188
189
190
···
408
下一页
公告