Computer Science

자주 사용하는 R 명령어 및 패키지

한거루 2024. 1. 21. 18:07

R 명령어

새로운 워킹 디렉토리 설정하기 : setwd()

ex) setwd("C:/Users/00zer/Desktop/scRNAseq-scDEA")

현재 디렉토리 확인하기 : getwd()

 

패키지가 저장된 경로 확인 및 지정: .libPaths()

ex) .libPaths() - 확인

ex) .libPaths("C:/Users/00zer/Desktop/scRNAseq-scDEA/lib")

패키지

install.packages("devtools")  # devtools 패키지 설치
library(devtools)

install.packages("BiocManager")
library(BiocManager)

 

주의 사항

1. 

The warning messages you received indicate that the Bioconductor version you are using (version 3.18) is attempting to replace the default repository settings for packages with a Bioconductor-specific repository, and it seems that it's unable to update packages in the default R library path (C:/Program Files/R/R-4.3.2/library in your case).

 

-> Use a Writable Library Path: The warning suggests that the installation paths are not writable. It's recommended to avoid installing packages in system directories. You can set a personal library path using the lib parameter in the install function:

BiocManager::install("limma",lib="C:/Users/00zer/Desktop/scRNAseq-scDEA/lib",force=TRUE)

 

2. 

내가 설치하려는 패키지(scDEA)에 필요한 종속성 패키지(qlcMatrix)가 설치가 안되는 경우가 있다.

따로 설치하거나 버전을 맞춤으로써 해결되는 경우가 대부분이지만

황당하게도 리포지토리에서 사라진 경우가 있다.

이런 경우 아래 링크(https://cran.r-project.org/src/contrib/Archive/)에서 해당 패키지를 찾아 주소 복사 하여 사용한다.

install.packages("https://cran.r-project.org/src/contrib/Archive/qlcMatrix/qlcMatrix_0.9.7.tar.gz", 
repos = NULL, type = "source", lib = "C:/Users/00zer/Desktop/scRNAseq-scDEA/lib")