随笔分类 -  R

摘要:代码笔记 library(psych)library(pheatmap) #以上导入包S9 <- read.csv(file.choose())rownames(S9)=S9[,1] #将第一列转为列名S9 <- S9[,2:11] #删除第一列S9 <- data.matrix(S9) #将dat 阅读全文
posted @ 2022-10-28 00:59 alan的学习笔记 阅读(182) 评论(0) 推荐(0)
摘要:plot type "p" for points, "l" for lines, 点图 "b" for both points and lines, 折线图 "c" for empty points joined by lines, 点线图(去点) "o" for overplotted point 阅读全文
posted @ 2021-10-22 23:50 alan的学习笔记 阅读(234) 评论(0) 推荐(0)
摘要:添加与修改矩阵的名字> dimnames(vec) <- list(c("e","f"),c("a","b","c")) 先行后列 > vec a b c e 1 3 5 f 2 4 6 > a [1] 2 3 4 > names(a) <- ("a") 给向量加名字 > a a <NA> <NA> 阅读全文
posted @ 2021-08-12 22:52 alan的学习笔记 阅读(686) 评论(0) 推荐(0)
摘要:> a <- c(1:20)给a赋值 > sum(a)求和 [1] 210 > max(a)最大值 [1] 20 > min(a)最小值 [1] 1 > mean(a)平均值 [1] 10.5 > var(a)方差 [1] 35 > sd(a)标准差 [1] 5.91608 > prod(a)连乘 阅读全文
posted @ 2021-08-11 23:17 alan的学习笔记 阅读(1183) 评论(0) 推荐(0)
摘要:getwd()查找当前位置 setwd(dir="")设置路径注意为/ 赋值: x<- c(5,6,7,8)赋值x为数组,内容为5,6,7,8 names(x) <- c("a","b","c","d")赋值名字 > a <- c(1:100) 给a赋值 > a[c(5:25)] 显示第五个数到第二 阅读全文
posted @ 2021-08-10 22:01 alan的学习笔记 阅读(43) 评论(0) 推荐(0)