🎸/R

[ R ] 맥북 M1 R, R Studio 설치

컴공생 C 2021. 3. 3. 11:25
반응형

 

cran.r-project.org/mirrors.html

 

CRAN - Mirrors

https://cran.asia/ Personnel Psychology Laboratory, Kwangwoon University (sites: Seoul, Tokyo, Singapore, Manila, Bangalore)

cran.r-project.org

위 링크로 들어가서 아무거나 클릭

 

아니면 그냥 아래 링크로 바로 들어가도 된다.

cran.seoul.go.kr/

 

The Comprehensive R Archive Network

 

cran.seoul.go.kr

 

Download R for (Mac) OS X 클릭

 

R-4.0.4.pkg 클릭해서 설치하기

계속-> 설치 -> 동의 등등 따라서 하면 설치완료

Finder 의 응용프로그램> R 클릭 > 콘솔 시작

이제 packages를 설치해보자.

install.packages("tidyverse")

입력하면 설치가 쭉 되는데  중간에 "tar failed to set default locale" 이런 에러가 났다.

더보기

터미널에서 아래 명령어를 입력한 후 R을 재시작 하면 해결된다.

defaults write org.R-project.R force.LANG en_US.UTF-8

설치가 완료되면 이런 화면이 뜬다.

추측하기로는 패키지 install 명령어를 통해서 설치된 tidyverse는 binary version, 여기서 물어보는건 source 버전 package를 설치하겠냐고 묻는듯 하다.

일단 결과화면이 교수님과 다르어서 Yes입력하니까 5분정도 설치가 추가적으로 이루어졌다. 그러나.. No를 입력하세요..

library(tidyverse) 

를 입력했을때 정상적인 출력이 되지 않았다 ^^

 

일단 하차하고 R studio가 패키지 다루기가 더 쉬워보여서 설치를 했다.

rstudio.com/products/rstudio/download/#download

 

Download the RStudio IDE

RStudio is a set of integrated tools designed to help you be more productive with R. It includes a console, syntax-highlighting editor that supports direct code execution, and a variety of robust tools for plotting, viewing history, debugging and managing

rstudio.com

 

여기서 바로 맥용을 설치하면 간단하다.

설치완료후 바로 실행시켜봤다. 아까 문제된 library(tidyverse)부터

이런식으로 없다고 하는애들을 설치하다가 너무 많아서 하차.

# create a list of all installed packages

 ip <- as.data.frame(installed.packages())

 head(ip)

# if you use MRO, make sure that no packages in this library will be removed

 ip <- subset(ip, !grepl("MRO", ip$LibPath))

# we don't want to remove base or recommended packages either\

 ip <- ip[!(ip[,"Priority"] %in% c("base", "recommended")),]

# determine the library where the packages are installed

 path.lib <- unique(ip$LibPath)

# create a vector with all the names of the packages you want to remove

 pkgs.to.remove <- ip[,1]

 head(pkgs.to.remove)

# remove the packages

 sapply(pkgs.to.remove, remove.packages, lib = path.lib)



출처: https://monogravity.tistory.com/107 [Beyond the Moon]

이걸 입력하고 재설치했다.

이때 NO를 입력하니 문제없이 설치되었다!!!!

처음부터 NO할걸!!!!

반응형