Korean, Edit

R 大调故障排除 [01-20]

推荐帖子 【R STUDIO】【R Studio 目录】(https://jb243.github.io/pages/1761)



1.错误:尝试使用零长度变量名

⑴(语法)原因当存在```



2. Error: cannot allocate vector of size 4.9 Gb

⑴ (system) Cause : The process exceeds the memory limit

① Memory demand is usually high during data analysis

② The memory limit set using memory.limit cannot exceed the RAM memory of the PC

③ Task Manager → Performance → Memory

○ Check the total capacity of the memory

○ Checking used slots and purchasing additional RAM could be a solution

○ (Note) For data analysis, it seems like having 32 GB of RAM is necessary

⑵ (grammar) Solution (Version 4.1.x or earlier)

memory.limit(size = 50000)

② # Increase the maximum memory limit of the computer to about 49GB

③ The above command is only applicable in Windows

⑶ (grammar) Solution (Version 4.2.x or later)

① “memory.limit() is no longer supported” error message occurs

② In this case, you can increase R’s maximum memory limit as follows (Reference)

图书馆(使用这个) 
使用这个::edit_r_environ()

# 然后,输入“R_MAX_VSIZE=100Gb”并保存.Renviron 文件。

③ However, in Windows R 4.2.x and above versions, memory is automatically increased, so there is no need to worry separately (Reference)

④ Note that these measures are effective on M1 MacBook Air or MacBook Pro

3. Error: .onLoad failed in loadNamespace() for ‘Cairo’, details: call: dyn.load(file, DLLpath = DLLpath, …) error: unable to load shared object ‘Library Frameworks R.framework Versions 4.1 Resources library Cairo libs Cairo.so’: dlopen(Library Frameworks R.framework Versions 4.1 Resources library Cairo libs Cairo.so, 0x0006): Library not loaded: opt X11 lib libXrender.1.dylib Referenced from: Library Frameworks R.framework Versions 4.1 Resources library Cairo libs Cairo.so Reason: tried: ‘opt X11 lib libXrender.1.dylib’ (no such file), ‘Library Frameworks R.framework Resources lib libXrender.1.dylib’ (no such file), ‘Users parkjeongbin lib libXrender.1.dylib’ (no such file), ‘usr local lib libXrender.1.dylib’ (no such file), ‘usr lib libXrender.1.dylib’ (no such file), ‘lib libXrender.1.dylib’ (no such file), ‘Library Java JavaVirtualMachines jdk1.8.0_241.jdk Contents Home jre lib server libXrender.1.dylib’ (no such file), ‘var folders rt qbr8l3sj73zd871cg_jmqrcm0

⑴ (package) Cause : XQuartz no longer provided on MacBooks

⑵ (package) Solution : Install XQuartz from https://www.xquartz.org/

⑶ Reference : https://stackoverflow.com/questions/38952427/include-cairo-r-on-a-mac



4. ERROR: lazy loading failed for package ‘SeuratWrappers’

⑴ (package) Situation : Problem occurs when running remotes::install_github('satijalab/seurat-wrappers')

⑵ (package) Cause 1. If R.utils is not installed, solve it by installing with install.packages("R.utils")

⑶ (package) Cause 2. https://github.com/satijalab/seurat-wrappers/issues/32



5. warning message: In normalizePath(path.expand(path), winslash, mustwork): path [1]=”C: Users ??? Documents” : file name, directory name, or volume label syntax is incorrect

⑴ (system) Cause : When the username contains Korean characters

⑵ (system) Solution 1. Change the username to English

⑶ (system) Solution 2. Change the working directory path using setwd or R Studio

⑷ This issue is not a big problem in R, but it can be problematic in Python



6. there is no package called ‘ifnb.SeuratData’

⑴ (package) Solution

install.packages(“https://seurat.nygenome.org/src/contrib/ifnb.SeuratData_3.0.0.tar.gz”,repos = NULLtype =”)

⑵ Reference : https://github.com/satijalab/seurat-data/issues/15



**7. RStudio requires an existing installation of R in order to work. Please select the version of R to use. **

⑴ (others) Solution



**8. The procedure entry point quadmath_snprintf could not be located in the dynamic link library C:\Users\USER\anaconda3\envs\MY_ENV\Lib\R\library\igraph\libs\x64\igraph.dll **

⑴ (package) Cause : The igraph.dll provided by CRAN assumes that Rlapack.dll provides the quadmath_snprintf function, but Anaconda R does not have the quadmath_snprintf function for some reason

⑵ (package) Solution : Install igraph using conda-forge

⑶ Reference : https://igraph.discourse.group/t/rterm-exe-entry-point-not-found/1326/3



9. “Error: Cannot allocate vector with size 13.3 GB”

⑴ (grammar) Solution



**10. Error in .testForValidKeys(x, keys, keytype, fks) : None of the keys entered are valid keys for ‘SYMBOL’. Please use the keys method to see a listing of valid arguments. **

⑴ (grammar) Issue : Using mouse genes instead of human genes in situations where human genes are required, using ENSG, ENSMUSG codes instead of gene names, etc.

⑵ (grammar) Example of solution

# 之前
基因.df <- bitr(MY_GENE_LIST, 
                fromType = "符号",
                toType = c("ENSEMBL", "SYMBOL","ENTREZID"),
                OrgDb = org.Hs.eg.db) 
                
# 之后
基因.df <- bitr(MY_GENE_LIST, 
                fromType = "符号",
                toType = c("ENSEMBL", "SYMBOL","ENTREZID"),
                OrgDb = org.Mm.eg.db)



11. Error in library(“clusterProfiler”) : there is no package called ‘clusterProfiler’

⑴ (grammar) Issue : On a MacBook, some packages often cause problems when only using install.package and BiocManager::install

⑵ (grammar) Solution : Instead of using RStudio, run the following code from CRAN

install.packages'RSQLite'依赖项= TRUE= TRUE
BiocManager::install('HDO.db', 依赖项 = TRUE,  = TRUE)
install.packages'graphlayouts'依赖项= TRUEforce = TRUE
BiocManager::install('clusterProfiler', 依赖项 = TRUE,  = TRUE)

⑶ Common solutions when install.packages causes problems

① Install from CRAN instead of R studio

② Run delete.packages(‘devtools’) and then install.packages(‘devtools’)

③ Reinstall R studio

④ Try on a different computer

⑤ Use additional arguments like install.packages(“devtools”, repos = NULL, type = “source”)

⑥ Use additional arguments like install.packages(‘devtools’, dependencies = TRUE, force = TRUE)

⑦ Get the library folder itself and paste it in the appropriate location within the desired PC

⑧ Increase timeout time with code like options(timeout=300)



12. Error in sum(dim(scRNAseqData)): argument “b” is missing, with no default

⑴ (grammar) Issue : Appears to be a collision when importing functions using the source statement, but it’s preferable to define necessary functions one by one rather than using source

(“https://github.com/JB243/nate9389/blob/main/RStudio/A_Collection_of_Useful_Functions_in_RStudio.R?raw=true”)

⑵ (grammar) Solution : Instead of importing functions with source, define the necessary functions individually

⑶ A similar issue arises with “do.call” r argument “b” is missing, with no default



13. Error in AddMetaData.Seurat(br.sp, pathways) : ‘col.name’ must be provided for atomic metadata types (eg. vectors)

⑴ (grammar) Issue : When pathways is of inappropriate data type, such as a double type variable

路径 <- as.data.frame(路径)
br.sp <- AddMetaData(br.sp, 路径)

⑵ (grammar) Solution



14. Error in dimnames(x) <- dn : ‘dimnames’ applied to non-array

⑴ (grammar) Issue : Currently, there is no way to change colnames of Seurat objects (Reference)

⑵ (grammar) Solution 1. Define a new Seurat object with different colnames (Reference)

⑶ (grammar) Solution 2. Modifying orig.ident can have a similar effect

object$orig.ident <- c('C', 'A', 'B')

# 重新排序
对象$orig.ident <- 因子(x = 对象$orig.ident, 级别 = c('A', 'B', 'C'))



15. Error in tmp[“CD34”, ]: invalid or not-yet-implemented ‘Matrix’ subsetting

⑴ (grammar) Issue : tmp variable is not a matrix. This problem can arise with sparse matrices

⑵ (grammar) Solution : Convert the tmp variable to matrix type

tmp = as.matrix(tmp)



16. Error in file(file, “rt”) : invalid ‘description’ argument

⑴ (grammar) Cause : Error occurs when Load10X_Spatial is used, and the cause is having both tissue_positions_list.csv and tissue_positions.csv files in the spatial folder (only one should be present)



17. Error in intI(i, n = d[1L], dn[[1L]], give.dn = FALSE) : invalid character indexing

⑴ (grammar) Cause 1. Problem occurs in Seurat pipeline when trying to overlay different matrix values on object@assays$RNA@data and object@assays$RNA@scale.data, and subtyping with object_ = object[, c(1:10)]

⑵ (grammar) Cause 2. Problem occurs when doing pbmc_ = pbmc[gene_list, ] and the gene_list contains underscores (_) (Examples)

Example 1. C4B_2

Example 2. GTF2H2C_2

Example 3. XLOC_008559

Example 4. XLOC_009911

Example 5. 18S_rRNA



18. Error in rownames<-(*tmp*, value = “Tumor_0-0Gy_1”) : attempt to set ‘rownames’ on an object with no dimensions

⑴ (grammar) Cause : When trying to assign a value to a factor type variable that is not a specific level, an error occurs

⑵ (grammar) Solution

# 示例
compGenomRData
Coldata_file <- system.file(“extdata/rna-seq/SRP029880.colData.tsv”,=compGenomRData”)
colData <- read.table(coldata_file, header = T, sep = '\t', 
                      字符串作为因素 = TRUE)
colData$source_name <- as.character(colData$source_name)
colData$group <- as.character(colData$group)

## 给定数据的示例版本
列数据[1,1] = "A"
列数据[1,2] = "B"

colData$source_name <- as.factor(colData$source_name)
colData$group <- as.factor(colData$group)

Reference



19. Warning message: In read.table(file = file, header = header, sep = sep, quote = quote, : incomplete final line found by readTableHeader on ‘my_data.csv’

⑴ (grammar) Solution : Use suppressWarnings

```python

之前

df <- read.csv(‘my_data.csv’)

之后

df <- 抑制警告(read.csv(‘my_data.csv’)) 受保护_10`

参考



20。在 MacBook 上打开 RStudio 时,仅出现空白屏幕

⑴ 问题情况

图片

⑵(系统)原因 RStudio工作区中除默认文件夹外还有韩文名称的文件夹时

图片

⑶(系统)解决办法将RStudio工作区中的文件夹名称更改为英文(默认文件夹除外)

图片 图片



输入 2022.01.29 17:33

修改 2023.06.02 18:13

results matching ""

    No results matching ""