Inspecting your data in R
Last updated on 2024-11-19 | Edit this page
Estimated time: 0 minutes
Overview
Questions
- How many rows and columns are in my data frame?
- What are the names of the columns in my data frame?
- How can I look up parts of my data frame?
- How do I find out what the internal structure of my data frame is?
Objectives
- Determine the number of rows and columns in a data frame
- Look up the names of the columns in a data frame
- Pull up sections of a data frame
- Inspect the internal structure of a data frame
Key Points
- Inspect the dimensions of a data frame using
dim() - Find out the number of rows and columns of a data frame using
nrowandrcol - Use
colnames()andrownames()to display column and row names respectively - Use
head()to view the first six rows of a data frame - Look at data in a specific column by using the
$operator - Use
[]to subset data from a data frame - Use
str()to inspect the internal structure of the data frame