iT邦幫忙

2024 iThome 鐵人賽

DAY 5
0
Python

Python和R入門語法比較系列 第 5

00[如何使用R] Asus、Acer、Dell電腦適用 - 安裝R、Rstudio

  • 分享至 

  • xImage
  •  

前篇:00[如何使用Python] (Mac作業系統)Apple電腦適用 - 認識自己的電腦 和 安裝python

下載 R

【Windows作業系統 - Asus、Acer、Dell..電腦適用】

1. google 'r download'

https://ithelp.ithome.com.tw/upload/images/20240918/201623980SLo0BXQln.png

2. 點選 'Download R-4.4.1 for Windows '

目前(113/9/18)R的版本是4.4.1
https://ithelp.ithome.com.tw/upload/images/20240918/20162398ByEqVs2K5R.png

3. 點選Chrome右上角 看下載進度

https://ithelp.ithome.com.tw/upload/images/20240918/20162398vk3GbxygIQ.png

【MacOs作業系統】 - Apple電腦適用

4. google 'download r for mac' 點選 'R for macOS'

https://ithelp.ithome.com.tw/upload/images/20240918/20162398AIiRcMNcRX.png

5. R-4.4.1-x86_64.pkg

https://ithelp.ithome.com.tw/upload/images/20240918/20162398D8TC7CJnJm.png

6. R-4.4.1-arm64.pkg

2020 年 06 月 24 日有一則有趣的報導:狼真的來了,蘋果真的改用自研的 ARM 架構處理器⋯⋯然後呢?
Apple公司,在2020年的WWWC(開發者大會),發表Apple自己研發的晶片。
https://ithelp.ithome.com.tw/upload/images/20240918/20162398JHLhmeQ9p7.png
Apple晶片目標在降低電池消耗的同時,亦提升運作效能:
圖片來源:2020年的WWWC(開發者大會)
自那之後,Apple電腦的處理器,就不再配備intel製造的,而是改成ARM架構,因此,在下載Mac版本的R,必須要注意自己的電腦配備的CPU,是intel的x86,還是Apple M1之後的CPU。
https://ithelp.ithome.com.tw/upload/images/20240918/20162398ADO8siCDyW.png

Windows下載.exe包 MacOs下載.pkg包 完成後

安裝R

7. 點選 Chrome右上角 '在資料夾中顯示' 開啟檔案位置

https://ithelp.ithome.com.tw/upload/images/20240918/201623984ExPKWtnqp.png

8. 點選 'R-4.4.1-win.exe'

https://ithelp.ithome.com.tw/upload/images/20240918/20162398CBIiQbUcCA.png

9. 確認檔案安裝的位址後 按下一步

Windows】 C:\Program Files\R\R-4.4.1
https://ithelp.ithome.com.tw/upload/images/20240918/20162398ttJtfnSbXO.png

10.

https://ithelp.ithome.com.tw/upload/images/20240918/20162398UVI9KBzxEJ.png

11.

https://ithelp.ithome.com.tw/upload/images/20240918/20162398yTm9iv6TS8.png

12. 按下一步之後會開始跑

https://ithelp.ithome.com.tw/upload/images/20240918/20162398prS5mcwPNl.png

13. 這時 可以到 【Windows】C:\Program Files 確認

https://ithelp.ithome.com.tw/upload/images/20240918/201623986Vi8Mks5cN.png

14. 選到 R-4.4.1檔案夾 R的資料都會在這裡

Windows】C:\Program Files\R\ R-4.4.1
https://ithelp.ithome.com.tw/upload/images/20240918/20162398Af9ECWZSnB.png

15. 再回來看安裝進度

https://ithelp.ithome.com.tw/upload/images/20240918/201623984EDZE9RWeH.png

16. 搜尋 'r' 點選 R'4.4.1'應用程式

https://ithelp.ithome.com.tw/upload/images/20240918/201623983mmXTbQFpo.png

用R 使用R

17. 可以在這裡寫R code

https://ithelp.ithome.com.tw/upload/images/20240918/201623980loXCiE7jR.png

18. 試打上 print("hi") 游標移到最右邊 按enter執行

https://ithelp.ithome.com.tw/upload/images/20240918/20162398w7QUJIr2dz.png

19.

>R程式碼
[1]程式執行結果
https://ithelp.ithome.com.tw/upload/images/20240918/20162398Tp5ExiHrsP.png
這是個 很陽春的介面
我們要下載一個漂亮一點的介面:R studio

安裝Rstudio

20. 搜尋Rstudio 點選 RStudio Desktop

https://ithelp.ithome.com.tw/upload/images/20240918/20162398Hj42h3YVGv.png

21. 進來首頁

https://ithelp.ithome.com.tw/upload/images/20240918/20162398ujGnGxqlGI.png

22. 滑下來看到 'Install Rstudio' 點選 DOWNLOAD RSTUDIO DESKTOP FOR WINDOWS

自己的電腦,Windows作業系統需是Win10/11版本。
https://ithelp.ithome.com.tw/upload/images/20240918/20162398I0hDGA1rgy.png

23. 如果是MacOS 再往下滑到此 尋找 Rstudio-2024.04.2-764.DMG

目前(113/09/18)最近的版本是2024.04.2
https://ithelp.ithome.com.tw/upload/images/20240918/20162398gDn2t85khV.png

24.

自己的電腦,Mac作業系統需12以上版本。
https://ithelp.ithome.com.tw/upload/images/20240918/20162398iPbCkitThH.png

Mac如何確認自己的作業系統

認識自己的電腦

25. 點選chrome右上角 查看下載進度 若好了 點選'在資料夾中顯示'

https://ithelp.ithome.com.tw/upload/images/20240918/20162398bma3IYzdTe.png

26. 找到 Rstudio-2024.04.2-764 【Windows】是.exe檔【MacOS】是.dmg檔

https://ithelp.ithome.com.tw/upload/images/20240918/201623988xTBBuSwmH.png

27. 開始安裝Rstudio

https://ithelp.ithome.com.tw/upload/images/20240918/20162398fVe22ez1do.png

28. 確認安裝位置

Windows】C:\Program Files\Rstudio
https://ithelp.ithome.com.tw/upload/images/20240918/201623982fFhoMGUkB.png

29.

https://ithelp.ithome.com.tw/upload/images/20240918/20162398TYiAq35K3A.png

30.

https://ithelp.ithome.com.tw/upload/images/20240918/20162398CMS9bJCsAM.png

31.

https://ithelp.ithome.com.tw/upload/images/20240918/20162398C5pDtmwd8I.png

用Rstudio 使用R

32. 搜尋 Rstudio 點選之

https://ithelp.ithome.com.tw/upload/images/20240918/20162398coWZfA9Ar4.png

33. 一進來會看到 如步驟19. 陽春的介面一樣的畫面 點選右上角(紅色處)

https://ithelp.ithome.com.tw/upload/images/20240918/20162398BYP7uGAhRi.png

34. 打開草稿Script畫面

https://ithelp.ithome.com.tw/upload/images/20240918/20162398Dxo7XQe86a.png

35. 在這裡打上程式碼 游標移到最右邊 左手按住ctrl 右手按enter 可執行

Rstudio左半邊
上半部)程式草稿
下半部)執行視窗
https://ithelp.ithome.com.tw/upload/images/20240918/20162398JOj12RF8YC.png

下篇預告:(輸入/輸出)Python的print, input, type和變數 和 R語法

內容預告:

Python v. R 的內容

01 Python的write( ) #寫檔

02 encoding 編碼 是什麼

02 Python的read... #讀檔

03 more about csv in Python and R

04 Python: pandas Series 數值資料 v R: 數值向量

05 Python: Pandas Series 字串資料 v. R:文字向量


上一篇
00[如何使用Python] (Mac作業系統)Apple電腦適用 - 認識自己的電腦 和 安裝python
下一篇
(輸入/輸出) Python的print, input, type和變數 和 R的語法
系列文
Python和R入門語法比較13
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言