05 2022 档案
摘要:1、小写转换为大写 [root@PC1 test]# ls a.txt test.py [root@PC1 test]# cat a.txt U R D S F E A D E x v m e f x e r d z d v [root@PC1 test]# cat test.py ## 小写转换为
阅读全文
摘要:1、 [root@PC1 test]# ls a.txt test.py [root@PC1 test]# cat a.txt U R D S F E A D E j k x v m j e f x e r d k j k u z d v [root@PC1 test]# cat test.py #
阅读全文
摘要:1、提取以x开头的行 [root@PC1 test]# ls a.txt test.py [root@PC1 test]# cat a.txt u r d s f e a d e x v m e f x e r d z d v [root@PC1 test]# cat test.py ## 提取以x
阅读全文
摘要:1、 [root@PC1 test]# ls a.txt test.py [root@PC1 test]# cat a.txt u r d s f e a d e x v m e f x e r d z d v [root@PC1 test]# cat test.py ## 提取程序,提取文本中包含
阅读全文
摘要:1、date命令 [root@PC1 home]# date ## 显示当前时间 Tue May 31 16:39:18 EDT 2022 [root@PC1 home]# date "+%H:%M:%S" ## 时分秒 16:39:29 [root@PC1 home]# date "+%Y-%m-
阅读全文
摘要:x86:x86是指intel开发的⼀种32位指令集,从386开始时代开始的,⼀直沿⽤⾄今,是⼀种cisc指 令集,所有intel早期的cpu,amd早期的cpu都⽀持这种指令集,ntel官⽅⽂档⾥⾯称为“IA-32”。AMD64:后来AMD推出了兼容32位的64位集关于IA-32的扩展,之后改名为A
阅读全文
摘要:1、查看系统 [root@PC1 home]# cat /etc/redhat-release Red Hat Enterprise Linux release 9.0 (Plow) 2、测试yum仓库 [root@PC1 home]# yum install httpd Updating Subs
阅读全文
摘要:1、查看系统 [root@PC1 home]# cat /etc/system-release Red Hat Enterprise Linux release 9.0 (Plow) 2、当前IP [root@PC1 home]# ifconfig | head ens160: flags=4163
阅读全文
摘要:1、查看系统 [root@PC1 network-scripts]# hostnamectl Static hostname: PC1 Icon name: computer-vm Chassis: vm 🖴 Machine ID: 43d69e6f6dc9444d83a0047a6a16c037
阅读全文
摘要:1、测试yum仓库 [root@localhost ~]# yum install httpd Updating Subscription Management repositories. Unable to read consumer identity This system is not reg
阅读全文
摘要:1、系统 [root@localhost ~]# cat /etc/system-release Red Hat Enterprise Linux release 8.5 (Ootpa) 2、点击网络设置 3、 4、 5、 6、 7、 8、 [root@localhost ~]# ifconfig
阅读全文
摘要:0、查看系统 [root@localhost ~]# cat /etc/redhat-release Red Hat Enterprise Linux release 8.5 (Ootpa) 1、在命令行终端直接输入:nmtui [root@localhost ~]# nmtui 2、 选中Edit
阅读全文
摘要:1、系统 [root@localhost ~]# cat /etc/redhat-release Red Hat Enterprise Linux release 8.5 (Ootpa) 2、进入/etc/sysconfig/network-scripts/目录,编辑目录下网卡配置文件: [root
阅读全文
摘要:001、 root@PC1:/home/test2# ls test.txt root@PC1:/home/test2# cat test.txt ## 测试数据 chr logl_H1 l_remle p_wald 1 -3.078836e+03 1.000000e+05 6.973924e-01
阅读全文
摘要:1、 root@PC1:/home/test2# ls a.txt root@PC1:/home/test2# cat a.txt ## 测试数据 3.3724 34.348 988.383 0.0001 34.837 381.439 3.2534 32.732 358.346 root@PC1:/
阅读全文
摘要:001\ log1p()函数 = log(1 + number); 甚至当number值接近于0时也能准确的计算出结果。 log(10) log1p(9) ## 相当于log(1 + 9) log(1) log1p(0) ## 相当于log(1 + 0) log1p(1.718281828459)
阅读全文
摘要:01、测试数据 a-1 a-2 a-3 a-4 ex ue 88 33 a-s d-2 4-4 k-k xd ff eg 3d 02、 dir() dat <- read.table("a.txt", header = T, check.names = T) dat dat1 <- read.tab
阅读全文
摘要:001、 dat <- c("a", "b", "a", "a", "c", "k", "k", "c") ## 测试行名 df <- data.frame(a = 1:8, b = letters[1:8]) df rownames(df) <- dat ## 报错 uni <- unique(d
阅读全文
摘要:001、 +号的作用是匹配前面字符1次或连续任意多次 root@PC1:/home/test/test# ls a.txt root@PC1:/home/test/test# cat a.txt aaaabxa xxxxbxa root@PC1:/home/test/test# sed 's/a+/
阅读全文
摘要:001、管道符的应用需要加载dplyr包 dat <- read.table("a.txt") dat ## 测试数据 library(dplyr) ## 加载dplyr包 apply(dat[,1:2], 1, mean) %>% cbind(dat[,3:5]) ## 计算前两列的每一行的平均值
阅读全文
摘要:1、测试数据 root@PC1:/home/test/test# ls uma.txt root@PC1:/home/test/test# cat -A uma.txt 0^M^IAAACGCTGTAGCCA-1$ 0^M^IAAACTTGATCCAGA-1$ 1^M^IAAAGAGACGAGATA
阅读全文
摘要:1、 root@PC1:/home/test4# ls a.txt b.txt root@PC1:/home/test4# cat a.txt a a b b c d e root@PC1:/home/test4# cat b.txt c d e f f g root@PC1:/home/test4
阅读全文
摘要:1、测试数据 root@PC1:/home/test4# ls a.txt b.txt root@PC1:/home/test4# cat a.txt a b c d e root@PC1:/home/test4# cat b.txt c d d xef e f g 2、grep -f选项的作用表示
阅读全文
摘要:分类1:当两个文件没有重复项时。 1、测试数据 root@PC1:/home/test4# ls a.txt b.txt root@PC1:/home/test4# cat a.txt ## 测试数据 a b c d e root@PC1:/home/test4# cat b.txt c d e f
阅读全文
摘要:1、 >>> a = ["aa", "xx", "mm", "xx", "xx", "kk", "aa"] >>> a ['aa', 'xx', 'mm', 'xx', 'xx', 'kk', 'aa'] >>> a.count("xx") ## 统计指定元素的次数 3 &
阅读全文
摘要:1、 >>> a = [1, 2, 3, 4, 5, 6] >>> a [1, 2, 3, 4, 5, 6] >>> a[2:] ## 删除列表的前两个元素 [3, 4, 5, 6] 2、 >>> a [1, 2, 3, 4, 5, 6] >>> a[:len(a)-2] ## 删除列表中的后两个元
阅读全文
摘要:1、 >>> a = ['bb', 'aa', 'aa', 'dd', 'aa', 'mm', 'yy', 'aa'] ## 测试列表 >>> b = [] >>> begin = 0 ## 设定查找起始位置 >>> for i in range(0, a.count("aa")): ## 限定循环
阅读全文
摘要:1、for 循环实现 >>> a ['aa', 'bb', 'aa', 'cc', 'bb', 'dd', 'cc'] >>> b = list() >>> b [] >>> for i in a: ... if i not in b: ## 利用for循环 + 关系成员操作符去重复 ... b.a
阅读全文
摘要:1、 a <- c(2, 4, 1, 7, 6, 8, 3, 4) b <- letters[1:8] c <- rep(letters[1:4], each = 2) dat <- data.frame(a, b, c) dat tapply(dat$a, dat$c, sum) ## 对a列按照
阅读全文
摘要:1、应用于数据框 a <- c(2, 3, 6) b <- c(5, 2, 2) c <- c(4, 5, 1) dat <- data.frame(a, b, c) dat sapply(dat, sum) ## 对列进行循环, 求和, 返回向量 lapply(dat, sum) ## 返回列表
阅读全文
摘要:1、 a <- 1:5 b <- letters[1:2] dat1 <- list(a = a, b = b) dat1 ## 列表1 a <- 11:15 b <- LETTERS[1:5] dat2 <- list(a = a, b = b) dat2 ## 列表2 dat3 <- list(
阅读全文
摘要:1、创建列表 a <- 1:5 b <- "abcd" c <- matrix(1:9, nrow = 3) d <- letters[1:10] dat <- list(a = a, b = b, c = c, d = c) ## 创建列表, a = a操作的目的是给列表元素命名 dat ## 查
阅读全文
摘要:1、应用于列表 a <- c(3, 3, 7) b <- c(1, 8) c <- c(2, 4, 6, 3, 2) dat <- list(a, b, c) dat ## 测试数据 lapply(dat, sum) ## 每一项求和, 返回列表 lapply(dat, mean) 2、应用于向量
阅读全文
摘要:001、 gender <- sample(c("m", "f"), 6, replace = T) number <- 1:6 option <- sample(1:2, 6, replace = T) dat <- data.frame(gender, number, option) dat s
阅读全文
摘要:1、 dat <- read.table("outcome.map") dat split(dat, dat$V1) ## 依据第一列(染色体)直接拆分数据
阅读全文
摘要:1、针对行批量提取 a <- c("a", "b", "c", "a", "b", "b", "d", "d") b <- 1:8 c <- letters[1:8] d <- LETTERS[1:8] dat <- data.frame(a, b, c, d) dat row_target <-
阅读全文
摘要:1、 library(dplyr) a <- 1:5 b <- sample(10, 5) c <- rep(letters[1:5], each = 1) d <- letters[1:5] dat <- data.frame(a, b, c, d) ## 测试数据 dat select(dat,
阅读全文
摘要:1、方法1 >>> a = ["aa", "bb", "cc", "dd", "ee", "ff", "gg", "hh", "ii", "jj"] >>> a ['aa', 'bb', 'cc', 'dd', 'ee', 'ff', 'gg', &#
阅读全文
摘要:1、 >>> import random >>> a = ["aaa", "bbb", "ccc", "ddd"] >>> random.choice(a) ## 从列表中随机抽取元素 'aaa' >>> random.choice(a) 'ddd' >>> random.choice(a) 'aa
阅读全文
摘要:1、方法1 >>> a = ["aaa", "bbb", "ccc", "ddd", "eee", "fff"] >>> a ['aaa', 'bbb', 'ccc', 'ddd', 'eee', 'fff'] >>> temp = a[0] ## 交换位置1和位置3的元素, 使用第三方变量,避免覆
阅读全文
摘要:001、 >>> test ['aa', 'bb', 'cc', 'dd', 'ee', 'ff'] >>> test[-1] ## 逆向输出 'ff' >>> test[-2] 'ee' 002、 >>> test = ["aa", "bb", "cc", "dd", "ee", "ff
阅读全文
摘要:001、合并取交集 name1 <- c("aa", "bb", "cc", "dd") gender <- c("m", "m", "m", "f") age <- c(13, 14, 14, 15) dat1 <- data.frame(name1, gender, age) name2 <-
阅读全文
摘要:1、 测试数据读入R dat <- read.table("a.map") dat 2、 class(dat$V1) ## 查看第一列变量类型 chr <- as.factor(dat$V1) ## 转换为因子 chr result <- split(dat, chr) ## 按照因子进行拆分 re
阅读全文
摘要:001、 dat <- c(1, 1, 2, 3) dat ## 测试数据 prop.table(dat) (1 / 7) * 1 ## 意义验证 (1 / 7) * 2 (1 / 7) * 3
阅读全文
摘要:1、基本用法 a <- c(1, 2, 1, 2, 2) b <- c("a", "b", "a", "a", "a") dat <- data.frame(a, b) dat ## 测试数据框 table(dat$a) ## 统计a列中各个元素的频次,即1出现2次,2出现3次 table(dat$
阅读全文
摘要:001、 BiocManager::install("Biobase") BiocManager::install("GO.db") BiocManager::valid("GO.db")
阅读全文
摘要:1、 root@PC1:/home/test2# ls test.sh root@PC1:/home/test2# cat test.sh ## 脚本 #!/bin/bash ANSWER=$(expr $RANDOM % 100) TIMES=0 echo "the range is 0-100,
阅读全文
摘要:001、 root@PC1:/home/test2# ls root@PC1:/home/test2# a=abd root@PC1:/home/test2# echo $a abd root@PC1:/home/test2# [ $a =~ ^a ] && echo yes ## 单个[]不支持匹
阅读全文
摘要:1、 root@PC1:/home/test2# ls test.sh root@PC1:/home/test2# cat test.sh ## script #!/bin/bash SUM=0 MIN=100 MAX=0 COUNT=0 while [ $COUNT -lt 5 ] do read
阅读全文
摘要:001、replace:将字符串中的指定字符替换为另一个字符 >>> a = "abcd_abcd_abcd_abcd" >>> a 'abcd_abcd_abcd_abcd' >>> a.replace("a", "x") ## 将字符串中的指定字符替换为另一个字符 'xbcd_xbcd_xbcd
阅读全文
摘要:001、lower:将所有字母转换为小写(同casefold) >>> a = "ABCD" >>> a.lower() ## 将所有的字母转换为小写 'abcd' >>> b = "abCD" >>> b.lower() 'abcd' 002、upper:将所有的字母转换为大写 >>> a = "
阅读全文
摘要:1、 root@PC1:/home/test2# ls a.txt test.py root@PC1:/home/test2# cat a.txt ## 测试数据 z u x e j z e f a z x e w f e root@PC1:/home/test2# cat test.py ## p
阅读全文
摘要:001、istitle:判断是否为标题化字符串(所有单词第一个字母大写,其余小写) >>> a = "Abc Mn" >>> a.istitle() ## 判断字符串是否为标题化字符串 True >>> b = "abc mn" >>> b.istitle() False >>> c = "abc
阅读全文
摘要:001、startswith、endswith:判定字符串是否以指定字符串开头或者结尾 >>> a = "abcdxyz" >>> a.startswith("a") ## 判定字符串是否以指定字符开头 True >>> a.startswith("b") False >>> a = "abcdef
阅读全文
摘要:001、capitalize:将字符串的第一个字符改为大写,其他字符全部改为小写 >>> a = "abc" >>> b = "ABC" >>> c = "aBc" >>> a.capitalize() ## 将字符串的第一个字符改为大写,其他字符全部改为小写 'Abc' >>> b.capital
阅读全文
摘要:1、测试数据 root@PC1:/home/test2# cat a.txt d u s x e j z c e e f a z x e w f e 2、提取以z开头的数据 root@PC1:/home/test2# ls a.txt test.py root@PC1:/home/test2# ca
阅读全文
摘要:1、 gender <- rep(c("male", "female"), 2) age <- c(20, 30, 26, 32) height <- c(170, 180, 175, 178) dat <- data.frame(gender, age, height) dat aggregate
阅读全文
摘要:95%的置信区间? 1、 set.seed(100) a <- rnorm(100) library(car) qqPlot(a, main="qq plot", col="blue", col.lines="red") ## 绘图
阅读全文
摘要:filter函数的使用需要加载dplyr包 1、 a <- 1:10 b <- sample(10, 10) c <- rep(letters[1:5], each = 2) dat <- data.frame(a, b, c) dat library(dplyr) filter(dat, a <
阅读全文
摘要:管道符的作用:将前一个命令的输出作为后一个命令的输入。 管道符命令的使用需要用到dplyr包。 001、在函数中应用 library(dplyr) f1 <- function(x){return(x + 10)} f2 <- function(x){return(x * 2)} ## 首先定义两个
阅读全文
摘要:1、测试数据 root@PC1:/home/test2# ls a.txt root@PC1:/home/test2# cat a.txt d u s x e j z c e e f a x f e w f e 2、提取包含字符x的数据 root@PC1:/home/test2# ls a.txt
阅读全文
摘要:1、测试数据 2、读取数据 dir() dat <- read.table("a.txt", fill = T, header = F) ## 增加fill = T参数可以读取列数不一致的数据框 dat dat[dat == ""] = NA ## 将缺失值用NA补充 dat 3、简单处理(求第3行
阅读全文
摘要:1、不存在叫'EnsDb.Hsapiens.v86'这个名字的程辑包 2、 BiocManager::install("EnsDb.Hsapiens.v86") library(EnsDb.Hsapiens.v86)
阅读全文
摘要:1、当前系统 lsb_release -a ubuntu 22.04. 2、进入/etc/netplan/目录,列出该目录下的内容 cd /etc/netplan/ ls 3、利用vim编辑器打开xxx.yaml文件,进行编辑: vim 01-network-manager-all.yaml 内容如
阅读全文
摘要:1、ubuntu 虚拟机无法使用putty连接 2、检查是否安装了ssh服务 ps -e | grep ssh 说明没有安装ssh服务。 3、安装ssh服务 sudo apt-get install openssh-server 说明安装正常。 4、检查ssh服务 ps -e | grep ssh
阅读全文
摘要:1、确保网络连接正常,可以用ping测试 ping -c 3 www.baidu.com 说明网络连接没有问题。 2、更新软件仓库 apt update 3、执行如下命令 sudo apt-get autoremove open-vm-tools sudo apt-get install open-
阅读全文
摘要:001、par(mgp)选项的作用是调整坐标轴标签、刻度标签、刻度框线距离绘图区域的距离。 par(mfrow = c(2, 2)) par(mgp = c(3, 2, 0)) plot(1:10, main = "3 2 0", cex.main = 3) box(which = "figure"
阅读全文
摘要:001、par(mar)选项的作用是调整绘图区域距离外围框线的距离。作用和par(mai)一样, 可能只是单位不一样. par(mfrow = c(2, 2)) par(mar = c(1, 1, 1, 1)) plot(1:10, main = "mar = 1", cex.main = 3) b
阅读全文
摘要:001、par(oma)选项的作用是调整外框线距离绘图边界的距离。 par(oma = c(1, 1, 1, 1)) plot(1:10, main = "oma = 1", cex.main = 3) box(which = "figure", lwd = 5) box(which = "plot
阅读全文
摘要:001、mai的作用是调整绘图区域与外围框线的距离。 par(mfrow = c(2, 2)) par(mai = c(0.5,0.5,0.5,0.5)) plot(1:10, main = "mai = 0.5", cex.main = 3) box(which = "figure", lwd =
阅读全文
摘要:1、 plot(0:10, 0:10, pch = 16, col = "red", xaxs = "i", yaxs = "i") abline(h = 5, lwd = 5) ## 高度 2、 plot(0:10, 0:10, pch = 16, col = "red", xaxs = "i",
阅读全文
摘要:001 完整代码 dat <- read.table("result.fst", header = T) head(dat) chrlen <- vector() for (i in unique(dat$CHR)) { temp <- dat[dat$CHR == i, ] temp <- tem
阅读全文
摘要:1、 win + i 打开设置, 点击轻松使用 2、点击左下角键盘 3、将屏幕截图快捷方式点为开
阅读全文
摘要:1、 > plot(1:5, 1:5, xlim = c(0,6), ylim = c (0,6), type = "n") > arrows(x0 = 1, y0 = 1, x1 = 4, y1 = 4) 2、 同时画两个箭头 > plot(1:5, 1:5, xlim = c(0,6), yli
阅读全文
摘要:1、 > plot(1:10) > segments(1,1, 6, 4, lwd = 5, col = "red")
阅读全文
摘要:1、 完整代码: dat <- read.table("result.fst", header = T) head(dat) chrlen <- vector() for (i in unique(dat$CHR)) { temp <- dat[dat$CHR == i,] temp <- temp
阅读全文
摘要:[[:alnum:]] = [a-zA-Z0-9] root@PC1:/home/test/test# ls a.txt root@PC1:/home/test/test# cat a.txt GMM 201 0 0 0 GMM 202 0 0 0 GMM 203 0 0 0 root@PC1:/h
阅读全文
摘要:.表示:匹配任意一个字符。 ?表示:匹配前面一个字符0次或者1次。 *表示:匹配前面一个字符0次或者任意多次。 +表示:匹配前面一个字符1次或者任意多次。 .*表示:匹配任意一个字符0次或者任意多次,且为贪婪匹配。 .*?表示:匹配任意一个字符0次或者任意多次, 为非贪婪匹配。
阅读全文
摘要:+ 表示匹配前面的字符1次或任意多次。 001、R语言中: > sub("a+", "", c("aaaabxa","xxxxbxa")) ##+表示匹配前面的字符1次或任意多次; a+表示匹配a1次或者任意多次 [1] "bxa" "xxxxbx" 002、shell中: root@PC1:/ho
阅读全文
摘要:?表示匹配前面的字符0次或1次; *表示匹配前面的字符0次或任意多次; 001、在R语言中 > sub("a?b", "", c("aaaabxa","xxxxbxa", "xacb")) ## ?表示匹配前面字符0次或1次; a?b表示匹配b或者ab [1] "aaaxa" "xxxxxa" "x
阅读全文
摘要:.*表示贪婪匹配; .*?表示非贪婪匹配; 001、R语言中 > sub("a.*b", "", c("aabab","eabbe")) ##.*表示贪婪匹配,只要满足条件就一直匹配 [1] "" "ee" > sub("a.*?b","",c("aabab","eabbe")) ##.*?表示非贪
阅读全文
摘要:1、 .表示匹配任意字符一次; *表示匹配前一个字符0次或任意多次; 001、R语言中: > sub("a.c","",c("abcd", "sdacd", "addfcdf")) ## .表示任意一个字符 [1] "d" "sdacd" "addfcdf" > sub("a*c","",c("ab
阅读全文
摘要:001、 root@PC1:/home/test2# ls a.txt root@PC1:/home/test2# cat a.txt hello world root@PC1:/home/test2# sed 's/\(hello\) \(world\)/\2 \1/' a.txt ## 第一个小
阅读全文
摘要:1、 BiocManager::install("org.Mm.eg.db") library(org.Mm.eg.db)
阅读全文
摘要:R语言中assign用于给变量赋值。 001、 > assign("x", 100) ## 给x赋值 > x [1] 100 > assign("y", c("aaa", "bbb")) ## 给y赋值 > y [1] "aaa" "bbb" 002、用在循环中, 批量生成变量名 > for (i
阅读全文
摘要:mode:表示对象在内存中的存储类型。 class:表示的是变量的数据类型。 > a <- 1:10 > mode(a) ## 内存中存储为数值 [1] "numeric" > class(a) ## 变量类型为整数 [1] "integer" > b <- letters[1:10] > mode
阅读全文
摘要:attr()函数允许你创建任意属性并将其与对象关联。 1、 > a <- 1:5 > b <- letters[1:5] > c <- LETTERS[1:5] > dat <- data.frame(a, b, c) > dat ## 测试数据框 a b c 1 1 a A 2 2 b B 3 3
阅读全文
摘要:条件表达式: 1、 > a = 5 > ifelse(a %% 2 == 0, print("a is even"), print("a is odd")) ## 满足a %% 2 ==0, 执行第一个语句,否则执行第二个语句 [1] "a is odd" [1] "a is odd" > a =
阅读全文
摘要:1、 MAD定义为数据点到中位数的绝对偏差的中位数: 也就是说,先计算出数据与它们的中位数之间的残差(偏差),MAD就是这些偏差的绝对值的中位数。 参考:https://blog.csdn.net/horses/article/details/78749485
阅读全文
摘要:1、 rnorm函数生成服从正态分布的随机数: > rnorm(10, 3, 1) ## 生成10个平均数为3,标准差为1的服从正态分布的随机数 [1] 3.445787 3.046501 3.085338 2.972996 3.852173 3.125537 3.335456 3.385395 1
阅读全文
摘要:1、分位数表示有百分之多少的数值小于该处的数值。 quantile函数默认返回五个数值: 最小值、第一分位数值、 第二分位(中位数)、第三分位数值、最大值。 当数值个数为奇数时最为简单: 举例1: > a <- c(1, 3, 4, 6, 7, 9, 15) > a ## 测试向量, 长度为7,奇数
阅读全文
摘要:方法1: 1、利用match函数实现 > dir() [1] "dat.map" > map <- read.table("dat.map") > map ## map文件 V1 V2 1 1 55910 2 1 85204 3 1 122948 4 2 167127 5 2 176079 6 2
阅读全文
摘要:1、 > a <- c(3, 2, 2, 4) ## 测试向量 > a [1] 3 2 2 4 > prod(a) ## 求所有向量的乘积 [1] 48 > cumprod(a) ## 向量元素累积求积 [1] 3 6 12 48
阅读全文
摘要:1、 > a <- c(8, 3, 2, 5, 9, 7) ## 测试数值向量 > a [1] 8 3 2 5 9 7 > range(a) ## range返回最小值和最大值 [1] 2 9 2、 > a <- c(8, 3,NA, 2, 5, 9, 7) ## 测试向量 > a [1] 8 3
阅读全文
摘要:1、 > a <- c(3, 5, 2, 7, 9, 3) ## 测试数值向量 > a [1] 3 5 2 7 9 3 > diff(a, lag = 1) ## lag = 1, 后一个数减去前一个数的差 [1] 2 -3 5 2 -6 > diff(a, lag = 2) ## lag = 2,
阅读全文
摘要:1、 set.seed()函数的作用是设定随机数种子, 保证第二次产生的随机数可重复 > a <- rnorm(5) ## 生成5个随机数 > a [1] -0.8204684 0.4874291 0.7383247 0.5757814 -0.3053884 > b <- rnorm(5) ## 生
阅读全文
摘要:1、 > a <- c(8, 2, 7, 3, 7) > a [1] 8 2 7 3 7 > b <- c(3, 7, 5, 5, 2) ## 测试向量 > b [1] 3 7 5 5 2 > pmin(a, b) ## 返回成对值中的较小值 [1] 3 2 5 3 2 > pmax(a, b) #
阅读全文
摘要:1、 > par(mfrow = c(2,3)) > plot(1:10, bty = "o", main = "ooo", cex.main = 3) > plot(1:10, bty = "l", main = "lll", cex.main = 3) > plot(1:10, bty = "u
阅读全文
摘要:1、 > coor <- data.frame( x = c(3,4,5),y = c(10,20,30), + xend = c(2.5,3.5,4.5), yend = c(20,30,10)) > coor x y xend yend 1 3 10 2.5 20 2 4 20 3.5 30 3
阅读全文
摘要:cumsum函数用于对数值向量进行累加 1、 > dat <- c(3, 1, 7, 2, 4) > dat ## 数值向量 [1] 3 1 7 2 4 > cumsum(dat) ## 逐项累加 [1] 3 4 11 13 17 2、用于矩阵中 > a <- c(3, 2, 4, 1) > b <
阅读全文
摘要:1、系统 [root@PC1 network-scripts]# hostnamectl Static hostname: PC1 Icon name: computer-vm Chassis: vm Machine ID: 7d8c7dacd42740ff9603a3e8bbf222da Boot
阅读全文
摘要:1、win +i 打开设置,点更新与设置 2、点击安全中心 3、点击防火墙和网络保护 4、将公用网络点为关闭
阅读全文
摘要:1、当有端口绑定时(比如高校),使用NAT模式。 2、当没有端口绑定时,使用桥接模式。
阅读全文
摘要:御三家:华硕、技嘉、微星 御三家旗舰主板: 华硕重炮手 技嘉小雕 卫星迫击炮
阅读全文
摘要:1、 root@PC1:/home/test# ls a.txt root@PC1:/home/test# cat a.txt i aaaadff f aaewrg k aaarbcd j aaaaavvvv i aaaaaaaaere root@PC1:/home/test# grep -E "a
阅读全文
摘要:1、直接依据列名提取 > a <- 1:5 > b <- letters[1:5] > c <- LETTERS[1:5] > d <- letters[6:10] > dat <- data.frame(a, b, c, d) > dat a b c d 1 1 a A f 2 2 b B g 3
阅读全文
摘要:1、sort -u实现 root@PC1:/home/test# ls a.txt root@PC1:/home/test# cat a.txt a b c x y z a b c m n o m n o root@PC1:/home/test# sort -u a.txt ## sort -u删除
阅读全文
摘要:1、 root@PC1:/home/test# ls a.txt root@PC1:/home/test# cat a.txt ## 测试数据 d xaa c xaaa d xaaaa e xaaaaa f xaaaaaa d dff gfgfgf e dfgdg gfdgedr d dfef fc
阅读全文
摘要:1、 root@PC1:/home/test# ls a.txt root@PC1:/home/test# cat a.txt ## 测试数据 d aab c aaab d aaaax e aaaaax f aaaaaax root@PC1:/home/test# grep -E "a{2}" a.
阅读全文
摘要:1、提取以指定字符开头的行 > a <- c("abc", "axy", "123", "axy", "mnp") > b <- c("dse", "bcd", "ee4", "sdb", "345") > c <- c("mcy", "873", "345", "egs", &qu
阅读全文
摘要:1、第一列转化为行名 > x <- letters[1:5] > y <- 1:5 > z <- LETTERS[1:5] > dat <- data.frame(x, y, z) > dat ## 测试数据框 x y z 1 a 1 A 2 b 2 B 3 c 3 C 4 d 4 D 5 e 5
阅读全文
摘要:1、测试文件 2、加载readxl包、读取数据 > library(readxl) ## 加载readxl包 > dir() [1] "test.xlsx" > sheet1 <- read_xlsx("test.xlsx", sheet = 1, col_names = F) ## 利用read_
阅读全文
摘要:1、 > dir() [1] "outcome.map" "outcome.ped" > ped <- read.table("outcome.ped") ## 读取两个文件 > map <- read.table("outcome.map") > object.size(ped) ## 统计变量占
阅读全文
摘要:1、min-max数据标准化 > dat <- c(34, 24, 78, 43, 98, 87) ## 测试向量 > dat [1] 34 24 78 43 98 87 > min(dat) ## 最小值 [1] 24 > max(dat) ## 最大值 [1] 98 > (dat - min(d
阅读全文
摘要:中心化,所有项减去平均数 1、 > dat <- c(3, 6, 4, 8) > dat [1] 3 6 4 8 > mean(dat) [1] 5.2 > dat - mean(dat) ## 所有项减去平均值, 中心化 [1] -2.25 0.75 -1.25 2.75 > scale(dat,
阅读全文
摘要:一、中心化 数据的中心化: 所有数据减去平均数,该组数据平均值为0。 > dat <- c(3, 6, 4, 8) ## 测试数据 > dat [1] 3 6 4 8 > mean(dat) ## 平均值 [1] 5.2 > dat - mean(dat) ## 中心化, 所有项减去平均值 [1]
阅读全文
摘要:方法1: > (.packages()) ## 查看已安装的包 [1] "stats" "graphics" "grDevices" "utils" "datasets" "methods" [7] "base" > candidate_pak <- c("qqman", "data.table",
阅读全文
摘要:1、 > library(qqman) ## 未安装的包 Error in library(qqman) : 不存在叫‘qqman’这个名字的程辑包 > library(data.table) Error in library(data.table) : 不存在叫‘data.table’这个名字的程
阅读全文
摘要:curl函数用于绘制函数的曲线。 1、 curve(x+0, -10, 10, bty="l") 2、 curve(2*x + 3, -10, 10, bty="l") 3、 curve(x^2,-5,5,bty="l") 4、 curve(x^2+3*x+1,-10,5) 5、 curve(2^x
阅读全文
摘要:1、asp参数用于定义绘图区域纵轴与横轴的比例 par(mfrow = c(2, 2)) plot(1:10, cex = 3, pch = 16, main = "asp = 1", cex.main = 3, asp = 1) plot(1:10, cex = 3, pch = 16, main
阅读全文
摘要:一、grep函数 1、提取特定开头项 > dat <- c(34, 22, 43, 64, 52, 347, 54) ## 测试向量 > dat [1] 34 22 43 64 52 347 54 > grep("^3", dat) ## 从dat中检索,提取以3开头的项,返回的是索引 [1] 1
阅读全文
摘要:1、 library(ggplot2) Beijing <- c(116,40) ## 经纬度信息 Tokyo <- c(139, 36) Paris <- c(2, 48) Sydney <- c(150, -33) Newyork <- c(-74, 40) dat <- as.data.fra
阅读全文
摘要:1、subset实现 > a <- 1:4 > b <- 5:8 > c <- letters[1:4] > d <- LETTERS[1:4] > dat <- data.frame(a, b, c, d) > dat ## 测试数据框,共四列 a b c d 1 1 5 a A 2 2 6 b
阅读全文
摘要:1、 library(devtools) install_github('lchiffon/REmap') library(REmap)
阅读全文
摘要:1、 root@liujiaxinpc1:/home/test# echo $a 100 root@liujiaxinpc1:/home/test# echo $b root@liujiaxinpc1:/home/test# [ $a ] ## 变量有赋值, 返回真 root@liujiaxinpc
阅读全文
摘要:-n: 当字符串不为0是为真; 字符串为0是为假。 n表示non-zero 示例: root@liujiaxinpc1:/home/test# a=100 root@liujiaxinpc1:/home/test# echo $a 100 root@liujiaxinpc1:/home/test#
阅读全文
摘要:1、问题 > x <- c(1, 3, 2, 1, 2, 3) > y <- c(5, 7, 6, 8, 9, 6) > order(x) ## 返回了排序的索引 [1] 1 4 3 5 2 6 > order(y) [1] 1 3 6 2 4 5 > order(x, y) ## 当向量x相同时,
阅读全文
摘要:原文:https://blog.csdn.net/coolfishbone_joey/article/details/119956378 echo 显示内容颜色,需要使用 -e 参数 -e :打开反斜杠转义 (默认不打开) ,可以转义 “\n, \t” 等 -n:在最后不自动换行 str="kimb
阅读全文
摘要:1、举例1: root@PC1:/home/test# ls test.sh root@PC1:/home/test# cat test.sh #!/bin/bash read -p "please input a character: " KEY case $KEY in ## 利用变量KEY进行
阅读全文
摘要:1、统计频次 [root@localhost test]# ls a.txt [root@localhost test]# cat a.txt a a b a b a b b b b [root@localhost test]# awk '{array[$1]++} END {for(i in ar
阅读全文
摘要:1、问题vim编辑没有颜色 2、解决方法 [root@localhost test]# rpm -q vim-enhanced package vim-enhanced is not installed [root@localhost test]# yum install vim-enhanced.
阅读全文
摘要:问题 1、linux中vim backspace无法向左删除 2、解决方法 [root@localhost test]# echo "set backspace=2" >> ~/.vimrc ## 修改配置文件 3、测试 没有问题。
阅读全文
摘要:1、问题 vim 8.2 右键无法粘贴, 进入VISUAL 2、解决方法 [root@localhost ~]# find / -name "defaults.vim" /home/software/vim-8.2.1862/runtime/defaults.vim /usr/share/vim/s
阅读全文
摘要:1、系统 [root@localhost test]# lsb_release -a LSB Version: :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noa
阅读全文
摘要:1、测试数据 root@PC1:/home/test2# ls test.txt root@PC1:/home/test2# cat test.txt attatgcccagggtttgttacttcagatgtgtccagagtttctcccttct ggcaggttcatggtcttgctcac
阅读全文
摘要:1、系统 [root@centos7pc1 vim-8.2.1862]# hostnamectl Static hostname: centos7pc1 Icon name: computer-vm Chassis: vm Machine ID: d44b8799f26a411a87bb728b10
阅读全文
摘要:001、if [root@centos7pc1 test]# ls test.sh [root@centos7pc1 test]# cat test.sh ## 测试脚本,if判断 #!/bin/bash read -p "please input an num:" NUM if [ $NUM -g
阅读全文
摘要:方法1: 1、查看ip [root@centos7pc1 test]# ifconfig | head ens32: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.65.153 netmask 255.255.255
阅读全文
摘要:1、系统 [root@centos7pc1 test]# lsb_release -a LSB Version: :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-no
阅读全文
摘要:测试文件 root@PC1:/home/test2# touch file.txt root@PC1:/home/test2# mkdir data root@PC1:/home/test2# ls data file.txt root@PC1:/home/test2# ll -h total 12
阅读全文
摘要:1、R中gdata包读取execl数据报错 2、解决方法 安装perl: 下载地址:https://strawberryperl.com/ 3、重新读取, 指定perl的路径 all.counts <- read.xls('GSE61533_HTSEQ_count_results.xls', she
阅读全文
摘要:linux中printf命令用于格式化输出。 示例 001、 liujiaxin01@PC1:~/test2$ printf "姓名:%s\n身高:%dcm\n体重:%.2fkg\n" "小明" "180" "75.5" 姓名:小明 ## %s表示格式化为字符串strings; %d表示格式化为整数
阅读全文
摘要:1、 root@PC1:/home/test2# cat a.txt 1 2 3 4 5 root@PC1:/home/test2# awk '{printf("%s%\n", $1)}' a.txt awk: run time error: not enough arguments passed
阅读全文
摘要:001、 root@PC1:/home/test2# pwd ## 一个正常的linux命令 /home/test2 root@PC1:/home/test2# pwd; echo "xxx" ##;前执行正常,后面的命令能够正常执行 /home/test2 xxx root@PC1:/home/t
阅读全文
摘要:linux中sleep命令用于将当前动作延迟一段时间: 001、示例: root@PC1:/home/test2# date ## date命令显示当前日期 2022年 05月 04日 星期三 08:10:15 CST root@PC1:/home/test2# date && sleep 10 &
阅读全文
摘要:SECONDS变量用于记录从当前shell开始运行所流逝的秒数。 示例: root@PC1:/home/test# echo $SECONDS 1178 root@PC1:/home/test#echo $SECONDS && sleep 10 && echo $SECONDS 1204 1214
阅读全文
摘要:R语言中seq函数用于生成序列 1、 > seq(1,10) ## 指定起点和终点, 默认步长为1 [1] 1 2 3 4 5 6 7 8 9 10 > seq(1,10, 2) ## 指定步长为2 [1] 1 3 5 7 9 > seq(1,10, 3) ## 指定步长为3 [1] 1 4 7 1
阅读全文
摘要:1、测试数据 > dir() [1] "test.txt" > library(data.table) > dat <- fread("test.txt") ## 不加该参数 > dat V1 V2 1: ab 35 2: df 100 3: er 54 > class(dat$V2) [1] "i
阅读全文
摘要:1、intel i3、i5、i7、i9表示系列: 2、AMD cpu天梯图:https://www.mydrivers.com/zhuanti/tianti/cpu/
阅读全文
摘要:1、查看系统 [root@centos7pc1 test]# cat /etc/redhat-release CentOS Linux release 7.9.2009 (Core) [root@centos7pc1 test]# hostnamectl Static hostname: cento
阅读全文
摘要:1、-O , 指定下载文件的名称 示例: [root@centos7pc1 test]# ls [root@centos7pc1 test]# wget -O xxx.zip https://s3.amazonaws.com/plink1-assets/plink_linux_x86_64_2022
阅读全文
摘要:1、从cran安装(https://cran.r-project.org/) 示例: > install.packages("ggplot2") ## 安装 trying URL 'https://mirrors.bfsu.edu.cn/CRAN/bin/windows/contrib/4.1/gg
阅读全文
摘要:来源:https://blog.csdn.net/qq_45322084/article/details/123901724 1.环境 安装1.先执行命令安装EPEL仓库 yum install epel-release 2.然后再执行 yum install R 有提示就按 y键即可 安装完成输入
阅读全文
摘要:1、查看系统 [root@centos7pc1 software]# lsb_release -a LSB Version: :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-
阅读全文
摘要:1、查看系统 root@liujiaxinpc1:/home/test# lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.4 LTS Release: 20.0
阅读全文
摘要:1、系统 root@liujiaxinpc1:/home/test# lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.4 LTS Release: 20.04
阅读全文
摘要:1、查看系统及代码 root@liujiaxinpc1:/home# lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.4 LTS Release: 20.04
阅读全文
摘要:来源:https://blog.csdn.net/bigdog_1027/article/details/78924768 Ubuntu安装后默认的官方源是美国的服务器,但是美国服务器在国内安装软件等会有较大的限制。所以我们需要将默认的源切换为国内源。一般来说,常用的国内源有阿里源(这是中国官方源)
阅读全文
摘要:1、 001、apt-get是老版的命令,apt是新版的命令。 002、apt包含了apt-get、apt-cache等等,用起来更方便。 003、apt刚刚出来,所以允许有apt-get和apt共存,向后兼容,以后apt-get就要淘汰了。 来源:https://zhidao.baidu.com/
阅读全文
摘要:1、源(软件网址) /etc/apt/sources.list ## 指定了软件下载的地址 2、更新本地软件包管理器软件列表(可以在包管理器中查看) sudo apt-get update 3、安装本地软件包管理器软件列表中的软件(将软件列表中的软件和已安装的软件对比,需要更新则安装更新) sudo
阅读全文
摘要:linux 中 netstat命令用于统计网络相关信息。 常用命令示例: 1、查看IP [root@rhelpc1 test]# netstat | head ## 查看本机IP Active Internet connections (w/o servers) Proto Recv-Q Send-
阅读全文
摘要:1、 -a: 列出所有用户 -u:列出状态 -x:列出更详细的信息 通常使用 ps -aux | grep "xxx" 查看特定的进程 ps -ef | grep “xxx”查看特定进程 示例: root@PC1:/home/test# ps -aux | grep "admixture" ## 查
阅读全文
摘要:1、 root@PC1:/home/test# echo "aaabbb" aaabbb root@PC1:/home/test# echo -n "aaabbb" ## -n的作用是不要在最后自动换行 aaabbbroot@PC1:/home/test#
阅读全文
摘要:1、 root@PC1:/home/test2# ls a.txt root@PC1:/home/test2# cat a.txt 1 2 3 4 root@PC1:/home/test2# cat a.txt | sed "H; g" 1 1 2 1 2 3 1 2 3 4
阅读全文
摘要:1、 root@PC1:/home/test2# ls a.txt root@PC1:/home/test2# cat a.txt a b c d a b e f c d c d m n root@PC1:/home/test2# awk '{a[i++]=$0} END {for(j = i -
阅读全文
摘要:1、 root@PC1:/home/test2# for num in `seq 2 100`;do if [ `factor $num|awk '{print $2}'` == $num ];then echo -n "$num ";fi done;echo 2 3 5 7 11 13 17 19
阅读全文
摘要:index(x,y):返回字符y在字符串x中的位置。 示例: root@PC1:/home/test2# ls a.txt root@PC1:/home/test2# cat a.txt dgfe knkds dfdf dfewf zdfj ewkhd root@PC1:/home/test2# a
阅读全文
摘要:1、 root@PC1:/home/test2# ls a.txt root@PC1:/home/test2# cat a.txt a d g e e j e e j r d g e e j e f f e d k r d j root@PC1:/home/test2# awk '{array[$1
阅读全文
摘要:1、 root@PC1:/home/test# ls root@PC1:/home/test# touch {a..d}.txt {a..d}.csv root@PC1:/home/test# ls a.csv a.txt b.csv b.txt c.csv c.txt d.csv d.txt ro
阅读全文
摘要:1、sort + uniq实现 root@PC1:/home/test# ls a.txt root@PC1:/home/test# cat a.txt 1 2 a b 1 2 1 2 o p a b m m root@PC1:/home/test# sort a.txt | uniq ## 删除重
阅读全文
摘要:1、任意位置插入列 > a <- letters[1:5] > b <- LETTERS[1:5] > c <- sample(1:10,5) > d <- sample(letters[1:10],5) > e <- data.frame(a, b, c, d) > e ## 测试data.fra
阅读全文
摘要:1、 > a <- "aaabbbcccddd" > substr(a,1,2) ## 提取字符串a的前两个字符串 [1] "aa" > a <- "aaabbbcccddd" > substr(a,3,5) ## 3-5字符 [1] "abb" > substr(a, 5,nchar(a)) ##
阅读全文