What are the different data types in R?

Quick Overview

Asks for the data types in R, from the atomic types a single vector can hold to the structures built on top of them. Tests how well a data scientist knows the way R stores values, which matters when reading data, converting factors and debugging type coercion.

What are the different data types in R?

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: easy

Interview Round: Other

What are the different data types in R? Cover the basic types a single vector can hold and the structures R builds on top of them. ```hint Two levels Separate what one vector can hold, where every element shares a type, from the containers that can mix types. Comparing `typeof()` and `class()` on a few objects helps. ``` ### What a Strong Answer Covers - The six atomic vector types and which of them appear in everyday code - How an atomic vector differs from a list in what it can hold - How R tells integer and double values apart, and which one a plain number literal becomes - How data frames and factors are built from the simpler types ### Follow-up Questions - What does `c(1, "a", TRUE)` return, and what rule decides its type? - Why can `as.numeric()` on a factor of numbers give the wrong values, and how do you recover the original numbers? - How do `typeof()` and `class()` differ for a factor, a matrix and a data frame?

Overview: Asks for the data types in R, from the atomic types a single vector can hold to the structures built on top of them. Tests how well a data scientist knows the way R stores values, which matters when reading data, converting factors and debugging type coercion.

Nov 25, 2026
easyData ScientistOtherData Manipulation (SQL/Python)
0
0

What are the different data types in R? Cover the basic types a single vector can hold and the structures R builds on top of them.

What a Strong Answer Covers Guidance

  • The six atomic vector types and which of them appear in everyday code
  • How an atomic vector differs from a list in what it can hold
  • How R tells integer and double values apart, and which one a plain number literal becomes
  • How data frames and factors are built from the simpler types

Follow-up Questions Guidance

  • What does c(1, "a", TRUE) return, and what rule decides its type?
  • Why can as.numeric() on a factor of numbers give the wrong values, and how do you recover the original numbers?
  • How do typeof() and class() differ for a factor, a matrix and a data frame?