返回課程
AI014 專業人士

R 程式設計入門

本課程全面介紹 R 語言環境,涵蓋從基本的數值向量運算、物件屬性、陣列與矩陣處理、清單與資料框管理,到統計模型建立及高品質圖形製作的核心主題。非常適合用作統計分析與資料科學的入門教材。

4.9
30.0h
716 學習者
10 lessons
2 讚好
人工智能
開始學習

課程總覽

📚 內容概要

本課程是對 R 語言環境的全面介紹,涵蓋從基本數值向量操作、物件屬性、陣列/矩陣處理,到清單/資料框管理、統計建模以及高品質圖形製作等核心主題。適合作為統計分析與資料科學的入門教材。

掌握 R 語言的核心,開啟統計計算與資料視覺化的大門。

作者: R 開發核心小組

致謝: 本手冊由 R 開發核心小組維護。中文版感謝增加日本翻譯基礎的三重慎一(Shigeru MASE),以及李中平博士、李瑞博士等中文翻譯團隊的貢獻。

🎯 學習目標

  1. 初始化 R 會話,導航幫助系統,並應用基本語法規則(大小寫敏感性、賦值與註解)。
  2. 辨別並建立邏輯向量、字元向量,並妥善處理缺失值(NANaN)。
  3. 使用四種不同的索引方法來選擇、排除或修改資料的特定子集。
  4. 識別並修改 R 物件的內在屬性(模式與長度)。
  5. 利用 class()attr() 函數來管理物件的元資料與資料結構。
  6. 建立與操作因子與有序因子,以表示分類資料。
  7. 使用維度向量及 array() 函數定義與建構陣列與矩陣。
  8. 應用進階索引技術,包括使用索引矩陣來提取或修改特定元素。
  9. 執行線性代數運算,包含外積、廣義轉置與矩陣反演。
  10. 建構與修改清單:建立命名與非命名清單,並使用特定的 R 語法進行合併。

課程

Lesson

This lesson introduces the R programming environment, focusing on workspace management, the documentation hierarchy, and essential shell commands for project initialization. Students will also learn the fundamentals of R syntax, including the use of the assignment operator, the importance of case sensitivity, and how to utilize built-in examples for troubleshooting.

This lesson explores the fundamental structure of R objects, focusing on atomic vectors as the primary unit of data storage and the importance of homogeneity. Students will learn how to interrogate object properties using diagnostic functions like typeof() and length(), and how to manage data identity through explicit coercion.

This lesson explores the foundations of multi-dimensional data in R, focusing on how arrays are constructed by applying dimension attributes to atomic vectors. Students will learn to perform matrix operations, understand the recycling rule, and utilize k-way arrays to efficiently organize and index large-scale datasets.

This lesson explores advanced data management in R, focusing on the structural differences between homogeneous atomic vectors and heterogeneous lists. Students will learn to organize complex datasets by creating and subsetting lists, manipulating tabular data with data frames, and performing file I/O operations.

This lesson covers the fundamentals of data ingestion and structuring in R, including the use of lists, matrices, and data frames for statistical analysis. It also introduces R’s standardized d-p-q-r prefix system, which provides a unified framework for calculating probability densities, cumulative distributions, quantiles, and random sampling.

This lesson introduces program control in R, focusing on how conditional statements and iterative loops allow scripts to move beyond linear execution to handle dynamic, data-driven logic. Students will learn to implement branching and looping structures to ensure code reliability and achieve predictable outcomes when processing complex datasets.

This lesson explores the transition from manual scripting to automated programming in R by utilizing control flow, vectorized operations, and the apply family of functions. Students will also learn to design custom functions, manage variable scoping, and implement modular code to improve scalability and efficiency.

This lesson explores statistical modeling in R, focusing on the use of data frames, symbolic formula syntax, and polymorphic functions to streamline analysis. Students will learn how to implement linear and non-linear models, perform parameter estimation, and utilize generic extraction tools to evaluate model fit and diagnostics.

This lesson explores the architecture of R graphics, focusing on the Painter’s Model where high-level functions initialize canvases and low-level functions add specific visual layers. Students will learn how to map statistical outputs, such as Hessian matrices from non-linear models, to geometric visualizations while managing R's library environments and plotting paradigms.

This lesson explores the R package ecosystem, distinguishing between the CRAN global repository and local library management while introducing tools for package introspection and environment configuration. Students will also learn about the role of namespaces in ensuring function integrity and how to maintain reproducible, portable code across different system architectures.