How do you check the structure of a data frame in R?

Quick Overview

Asks how to inspect the structure of a data frame in R after loading data. Tests basic R fluency with the functions that report size, column types and sample values, and whether you can spot import problems such as numbers stored as text.

How do you check the structure of a data frame in R?

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: easy

Interview Round: Other

How do you check the structure of a data frame in R? Assume you have just imported a file and want to know what you are working with before any analysis. ```hint What could go wrong on import Think about what you need to know first about a freshly imported table, and which output would reveal a numeric column that was read as text. ``` ### What a Strong Answer Covers - The main function for a compact overview, and how to read its output - Functions for size, column names and previewing rows - How to get per-column summaries and spot missing values - What changes for tibbles and tidyverse workflows - The problems a structure check typically reveals after importing data ### Follow-up Questions - `str()` shows a price column as `chr`. What likely happened on import, and how do you fix it? - How do you get the class of every column as a named vector? - How do you count missing values per column? - What changes in the `str()` output when the object is a tibble?

Overview: Asks how to inspect the structure of a data frame in R after loading data. Tests basic R fluency with the functions that report size, column types and sample values, and whether you can spot import problems such as numbers stored as text.

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

How do you check the structure of a data frame in R? Assume you have just imported a file and want to know what you are working with before any analysis.

What a Strong Answer Covers Guidance

  • The main function for a compact overview, and how to read its output
  • Functions for size, column names and previewing rows
  • How to get per-column summaries and spot missing values
  • What changes for tibbles and tidyverse workflows
  • The problems a structure check typically reveals after importing data

Follow-up Questions Guidance

  • str() shows a price column as chr . What likely happened on import, and how do you fix it?
  • How do you get the class of every column as a named vector?
  • How do you count missing values per column?
  • What changes in the str() output when the object is a tibble?