R언어 시각화 통계 입문
동그랑땡의 github 자세히보기

동그랑땡의 데이터 데이터 데이터/R언어 입문땡

R 스튜디오 맥 "clipboard" 기능 안된다면! X11 module 오류 해결법

동그랑땡12 2023. 9. 12. 20:47

R로 갖고오고 싶은 엑셀 내용을 드래그 복사한 후

data1 = read.table("clipboard",h=T)

아래와 같이 "clipboard"를 활용하여 변수에 넣으려고 했는데

오류가 떴다.

data1 = read.table("clipboard",h=T)
Error in file(file, "rt") : X11 module cannot be loaded
In addition: Warning message:
In file(file, "rt") :
  unable to load shared object '/Library/Frameworks/R.framework/Resources/modules//R_X11.so':
  dlopen(/Library/Frameworks/R.framework/Resources/modules//R_X11.so, 0x0006): Library not loaded: /opt/X11/lib/libSM.6.dylib
  Referenced from: <B3716E5A-BF4D-3CA3-B8EB-89643DB72A04> /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/modules/R_X11.so
  Reason: tried: '/opt/X11/lib/libSM.6.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/X11/lib/libSM.6.dylib' (no such file), '/opt/X11/lib/libSM.6.dylib' (no such file), '/usr/local/lib/libSM.6.dylib' (no such file), '/usr/lib/libSM.6.dylib' (no such file, not in dyld cache)

오류 라인에 뜬 X11 module 문제를 해결하기 위해 XQuartz를 깔았지만 여전히 문제가 해결되지 않았다.

혹시나 XQuartz를 깔아보고 싶은 분들을 위해 맨 아래 링크 남겨둔다.

 

하지만!

 

깔아도 소용없다.

 

대신 사용할 코드를 소개한다.

data1 = read.table(pipe("pbpaste"), sep="\t", h=T) # 2023/11/10 sep="\t" 추가

"clipboard" 대신에 pipe("pbpaste") 사용하자.

 


참고

Macbook Air M1 사용중이다.

 

XQuartz 다운로드 링크 

 

XQuartz

The XQuartz project is an open-source effort to develop a version of the X.Org X Window System that runs on macOS. Together with supporting libraries and applications, it forms the X11.app that Apple shipped with OS X versions 10.5 through 10.7. Quick Down

www.xquartz.org

 

 

Can't load X11 in R after OS X Yosemite upgrade

Running into the following error when I try to use ggplot2 and plot within the console after upgrading to Yosemite: Error in (function (display = "", width, height, pointsize, gamma, bg, : X11

stackoverflow.com

 

Clipboard reading and writing with R on the Mac

Writing R objects to the clipboard is very useful but a bit tricky on a Mac.  Try the following code to write the my.data dataframe to the clipboard and then paste to an excel spreadsheet.  This is…

tonyladson.wordpress.com

 

 

Clipboard hack for R in MAC

When I first started using the statistical software R for statistics I had started on a Windows computer. For here the copying and pasting function is read.table(“clipboard”, header=T) …

ghoti.blog

 

});