Introduction à la programmation en R
Ce cours constitue une introduction complète à l'environnement de langage R, couvrant des sujets fondamentaux tels que les opérations de base sur les vecteurs numériques, les attributs d'objets, le traitement des tableaux et matrices, la gestion des listes et des cadres de données, ainsi que la modélisation statistique et la production de graphiques de haute qualité. Il convient particulièrement bien comme ouvrage d'introduction à l'analyse statistique et à la science des données.
Aperçu du cours
📚 Résumé du contenu
Ce cours constitue une introduction complète à l'environnement de langage R, couvrant des sujets fondamentaux allant des opérations de base sur les vecteurs numériques, des attributs d'objets et de la gestion des tableaux/matrix aux manipulations de listes et cadres de données, aux modèles statistiques et à la production de graphiques de haute qualité. Il convient parfaitement comme manuel d'introduction à l'analyse statistique et à la science des données.
Maîtrisez les bases du langage R et ouvrez la porte au calcul statistique et à la visualisation des données.
Auteur : Équipe principale de développement de R
Remerciements : Ce manuel est entretenu par l'Équipe principale de développement de R. La version française tient compte de la traduction japonaise réalisée par Shigeru MASE, ainsi que des contributions de l'équipe de traduction en chinois, notamment Dr. ZP Li, Dr. Rui Li.
🎯 Objectifs d'apprentissage
- Initialiser des sessions R, naviguer dans le système d'aide et appliquer les règles syntaxiques de base (sensibilité à la casse, affectations et commentaires).
- Différencier et créer des vecteurs logiques, des vecteurs caractères, et gérer les valeurs manquantes (
NAetNaN). - Utiliser quatre méthodes d'indexation distinctes pour sélectionner, exclure ou modifier des sous-ensembles spécifiques de données.
- Identifier et modifier les attributs intrinsèques (mode et longueur) des objets R.
- Utiliser les fonctions
class()etattr()pour gérer les métadonnées des objets et les structures de données. - Créer et manipuler des facteurs et des facteurs ordonnés afin de représenter des données catégorielles.
- Définir et construire des tableaux et matrices à l'aide de vecteurs de dimensions et de la fonction
array(). - Appliquer des techniques d'indexation avancées, y compris l'utilisation de matrices d'index pour extraire ou modifier des éléments spécifiques.
- Exécuter des opérations d'algèbre linéaire telles que les produits externes, les transpositions généralisées et les inverses matriciels.
- Construire et modifier des listes : créer des listes nommées et non nommées, et les combiner à l’aide de syntaxe R spécifique.
Leçons 共 10 课时 · 预计 30.0h
Leçons
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.