随笔分类 - [31] R
摘要:如何安装和管理R的多个版本首先如果是需要最新的R版本的话,可以从清华镜像下载(速度也快)https://mirrors.tuna.tsinghua.edu.cn/CRAN/ 若需要旧版本,则可以从这下载https://cran.r-project.org/bin/windows/base/old/
阅读全文
摘要:1 S4类 S4类是R语言中一种更为严格和复杂的面向对象编程方式。与更简单的S3类相比,S4类提供了更高的灵活性和严格性,适用于需要明确结构的复杂数据和应用场景。 更为详细的介绍:https://www.jianshu.com/p/dd181f0698a7 1.1 S4类的主要特点 严格的数据类型检
阅读全文
摘要:https://www.cnblogs.com/huaan011/p/18348912 https://docs.pingcode.com/ask/180671.html R语言中$和@是什么意思R语言中的$和@运算符在数据操作中扮演着至关重要的角色。$用于提取或替代列表、数据框(data fram
阅读全文
摘要:new_df <- df[ order(row.names(df)), ]REF:https://stackoverflow.com/questions/20295787/how-can-i-use-the-row-names-attribute-to-order-the-rows-of-my-da
阅读全文
摘要:# first remember the names n <- df.aree$name # transpose all but the first column (name) df.aree <- as.data.frame(t(df.aree[,-1])) colnames(df.aree) <
阅读全文
摘要:So there is no na.action argument for the form you used, and your 'na.omit' matches 'retx'. Try prcomp(~ ., data=ot, na.action=na.omit, scale=TRUE) or
阅读全文
摘要:# 创建data.frame student<-data.frame(ID=c(11,12,13),Name=c("Devin","Edward","Wenli"),Gender=c("M","M","F"),Birthdate=c("1984-12-29","1983-5-6","1986-8-8
阅读全文
摘要:install.packages("rstan") 安装失败 试开URL’https://mirrors.e-ducation.cn/CRAN/src/contrib/rstan_2.21.2.tar.gz'Content type 'application/x-gzip' length 11520
阅读全文
摘要:## radian 弧度## degree 角度## 弧度 转 角度radian2degree <- function(radian) {(radian * 180) / (pi)}## 角度 转 弧度degree2radian <- function(degree) {(degree * pi)
阅读全文
摘要:C语言在线编辑器编译器IDE http://codepad.org/ C#语言在线编辑器编译器IDE http://www.dooccn.com/csharp/ C++语言在线编辑器编译器IDE http://www.dooccn.com/cpp/ Java语言在线编辑器编译器IDE http://
阅读全文
摘要:> scRNA <- FindNeighbors(scRNA, dims = pc.num) Computing nearest neighbor graph Computing SNN Error in validObject(.Object) : invalid class “Graph” ob
阅读全文
摘要:> library("Seurat")Error: package or namespace load failed for ‘Seurat’: object ‘markvario’ is not exported by 'namespace:spatstat'In addition: Warnin
阅读全文
摘要:installing via 'install.libs.R' to C:/Program Files/R/R-3.6.0/library/00LOCK-stringi/00new/stringi downloading the ICU data library (icudt) output pat
阅读全文
摘要:# 获取操作符[[的帮助 ?`[[` 相同点: 两者作用都是“提取”,当从一个向量或矩阵中提取第3个元素时,两者结果相同! > aaa<-c(1,2,3,4,5) > aaa[3] [1] 3 > aaa[[3]] [1] 3 不同点: 当数据不是一个list时,情况就不同了。 [] extract
阅读全文
摘要:> BiocManager::install("stringi",ask = F,update = F) 'getOption("repos")' replaces Bioconductor standard repositories, see '?repositories' for details
阅读全文
摘要:There are binary versions available but the source versions are later: binary source needs_compilation xfun 0.22 0.24 TRUE tinytex 0.31 0.32 FALSE rma
阅读全文
摘要:dim(t1) attributes(t1) #综合输出所有行名、列名、以及class结果。 str(t1) #显示每个变量的行列数和类型 class(t1) #查看变量类型,vector、data.frame、matrix、factor、listmode(t1) #查看数据大类,character
阅读全文
摘要:In install.packages(update[instlib == l, "Package"], l, repos = repos, : installation of package ‘tinytex’ had non-zero exit status Error in loadNames
阅读全文
摘要:统计每行的yes的个数 isA=c("yes","no","yes",NA)isB=c("no","yes","no",NA)df <- data.frame(isA,isB)df isA isB1 yes no2 no yes3 yes no4 <NA> <NA> df$ans<-apply(df
阅读全文
摘要:colSums(is.na(df2))rowSums(is.na(df2))sum(is.na(x))
阅读全文