阿好伯
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    --- disqus: ahb0222 GA : G-CQ4L16KHK4 --- R 語言_學習筆記-Rstudio === > [color=#40f1ef][name=LHB阿好伯, Jan 26, 2019 10:05 PM][:earth_africa:](https://www.facebook.com/LHB0222/) ###### tags: `R` [TOC] 學習R以前一定要先安裝其integrated development environment (IDE,整合開發環境) 撰寫多數程式碼都需要一套類似文書處理器的軟體編輯器(Editor) 程式寫好後需要編譯,就再需要一個編譯器(Compiler) 寫完的程式可能有一部分要跟其他程式連結在一起,又需要一個連結器(Linker) 這些都有了後,程式可能有錯誤,就需要除錯器(Debugger) 而學習R語言最推薦的IED就是Rstudio ### [**下載Rstudio**](https://www.rstudio.com/products/rstudio/download/) --- 甚至現在都有線上版的IDE [compile online </> com](http://www.compileonline.com/index.htm) 除了一般像是 C++、C、C#、Java 等等語言外 也支援 Matlb、R、SQLite SQL 等等桌上版軟體 對於網頁程式、或是標記語言,像是 HTML、CSS、JQuery、JQueryUI 等等都有支援 當然我只對R語言有涉略所以其他軟體也不知道可不可以使用 ![](https://i.imgur.com/8k9d9Ov.png) 簡單測試後發現對於擴充套件並不支援 但用來學習或是練習也是沒問題 可以減少安裝或是環境 --- RStudio的介面介紹 --- ▼常用的功能區 ![](https://i.imgur.com/kSp1or9.png) ▼Source editor 這是R語言的程式碼編輯區,你可以在此編輯程式碼,儲存,最後再執行。 ![](https://i.imgur.com/g2slB3e.png) ▼Workspace這區塊會紀錄在輸入所有指令相關物件的變數名稱和值 ![](https://i.imgur.com/xccO56r.png) 選History 標籤,可以在此看到Console 視窗所有執行指令的記銀 ![](https://i.imgur.com/pzp060E.png) ▼Console 位於RStudio視窗左下角是所謂的直譯器( Interpretor ) 使用此區塊視窗,在此可以直接輸入指令,同時獲得執行結果 ![](https://i.imgur.com/QlGvsrQ.png) 簡單變數設定方法如下 ```R x = 2 ``` or ```R x=3 ``` 中間有沒有空格並沒有影響,但空格後對於觀看上較佳 執行後設定的變數即會顯示在右上的Workspace ![](https://i.imgur.com/dbtu8wA.png) 還有第二種寫法為將等號 "=" 用小於減號 ==<-== 替代 > 可以利用快捷鍵來快速輸入 > > ==**"Alt" + "-"**== > ![](https://i.imgur.com/b9q84nS.png) ```R x <- 4 ``` or ```R x<-4 ``` 須注意一個問題 在變數設定上分大小寫 ⭐物件變數(也可簡稱物件)命名原則 1.下列名稱是R語言的保留字,不可當做是物件名稱。 break,else, FALSE,for, function, if,Inf, Nfl, NaN, next, repeat, return,TRUE, while 2.R對英文字母大小寫分得很清楚,所以basket與Basket,會被視為2個不同的物件. 3.物件名稱開頭必須是英文字母或點號("."),當以點號(".")開頭時,接續的第二個字母不可是數字。 4.物件名稱只能包含字母,數字,底線("_"),和點號(".") >另外一定要知道的快捷鍵就是 ==**"Ctrl" + "Enter"**== > >他可以快速執行編寫區域的程式碼 > > ![](https://i.imgur.com/Bjks9of.png)

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully