Atomic Data Types, Vectors & Coercion in R | Computational Statistics (10)

Опубликовано: 03 Июль 2026
на канале: Houston We Have a Problem
8
5

Welcome to the tenth lesson in our Computational Statistics series.

In this lecture, we dive into how the R programming language fundamentally stores, interprets, and manages data. Understanding how R categorizes information is critical for preventing widespread errors when importing or cleaning large datasets.

We begin by exploring the five atomic classes of objects in R: character, numeric (double), integer, complex, and logical. We walk through how to create vectors using the concatenate function and how to use the typeof(), class(), and attributes() functions to look under the hood of your data structures.

We also cover:
Implicit Data Coercion: How R automatically forces mixed data types into a single, general class (e.g., why a single text error in a sensor reading will turn your entire numeric dataset into character strings).
Explicit Data Coercion: How to intentionally convert data from one class to another using functions like as.numeric(), as.character(), and as.logical().
Immutability in R: Why conversion functions only change the output temporarily, and how to reassign variables to make permanent class changes.
Special Values & Nonsensical Coercions: How R handles undefined calculations (like Infinity and NaN) and why attempting to convert letters into numbers will result in NA (missing values).

► Watch the previous video in this series:    • Database Management Systems & SQL | Comput...  
► Watch the next video in this series:    • Database Management Systems & SQL | Comput...  

Don't forget to subscribe for more complete courses on mathematics and statistics.

TIMESTAMPS:
00:00:00 Introduction to data in R and the five atomic classes
00:00:39 What is a vector in R?
00:01:24 Numeric vs. Integer classes (The L suffix)
00:02:11 Special numbers: Infinity (Inf) and Not a Number (NaN)
00:02:51 Understanding object attributes in R (names, dimensions, class)
00:04:21 Creating vectors using the concatenate function
00:07:13 Creating integer and complex vectors
00:08:13 Creating empty vectors with the vector function
00:09:44 What is implicit data coercion in R?
00:12:26 How to explicitly coerce data using as. functions
00:14:48 Why you must reassign objects to save coerced data
00:17:04 What happens during nonsensical coercions (NA values)

Support the Channel
All of my lectures are provided completely for free. If this video helped you understand a complex topic or prepare for an exam, you can buy me a coffee here: https://ko-fi.com/houstonwehaveaprobl...