Back to Courses
AI014 Professional

An Introduction to R Programming

This course is a comprehensive introduction to the R language environment, covering core topics from basic numeric vector operations, object attributes, array and matrix processing, list and data frame management, to statistical modeling and high-quality graphics production. It is highly suitable as an introductory text for statistical analysis and data science.

4.9
30.0h
716 students
2 likes
Artificial Intelligence
Start Learning

Lessons

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.

Course Overview

📚 Content Summary

This course is a comprehensive introduction to the R language environment, covering core topics ranging from basic numerical vector operations, object attributes, and array/matrix handling to list/data frame management, statistical modeling, and high-quality graphics production. It is suitable as an introductory textbook for statistical analysis and data science.

Master the core of the R language and open the door to statistical computing and data visualization.

Author: R Development Core Team

Acknowledgments: 本手册由 R 开发核心小组维护。中文版感谢 Shigeru MASE 的日文翻译基础,以及 Dr. ZP Li, Dr. Rui Li 等中文翻译团队的贡献。

🎯 Learning Objectives

  1. Initialize R sessions, navigate the help system, and apply basic syntax rules (case sensitivity, assignments, and comments).
  2. Distinguish between and create logical vectors, character vectors, and handle missing values (NA and NaN).
  3. Utilize four distinct indexing methods to select, exclude, or modify specific subsets of data.
  4. Identify and modify the intrinsic attributes (mode and length) of R objects.
  5. Utilize the class() and attr() functions to manage object metadata and data structures.
  6. Create and manipulate factors and ordered factors to represent categorical data.
  7. Define and construct arrays and matrices using dimension vectors and the array() function.
  8. Apply advanced indexing techniques, including the use of index matrices to extract or modify specific elements.
  9. Execute linear algebra operations including outer products, generalized transposes, and matrix inversions.
  10. Construct and Modify Lists: Create named and unnamed lists and combine them using specific R syntax.

Lessons