Chapter 5 Preview Data
Reviewing data is an important part of data analysis. There are many different methods to review data within R, however a common practice to review data is to manually visualize the values in columns of a dataframe. This section will explore options for manually exploring data within a dataframe.
5.1 Inspect Data Structure
Prior to performing data analysis it is good to understand the elements, data types, and examples of the data within a dataframe.
5.1.1 Preview the structure of a dataframe
Description | |
---|---|
Method to inspect the data structure and elements of a dataframe |
Ingredients | |
---|---|
Package | Data |
readr |
sample.csv |
Preparation
<- readr::read_csv("C:/data/sample_parcel_land_sizes.csv") df
Sample Instructions
function(data)
Actual Instructions
str(df)
5.2 Preview Data
Manually reviewing data is a common practice to understand the data in a dataframe. R provides many options for manually reviewing dataframes.
5.2.1 Subset of rows to preview in a dataframe
Description | |
---|---|
Method to visually inspect the first few rows of a dataframe |
Ingredients | |
---|---|
Package | Data |
readr |
sample.csv |
Preparation
<- readr::read_csv("C:/data/sample_parcel_land_sizes.csv") df
Sample Instructions
function(data)
Actual Instructions
head(df)
5.2.2 Specify a set number of rows to preview in a dataframe
Description | |
---|---|
Method to visually inspect a specific number of rows of a dataframe |
Ingredients | |
---|---|
Package | Data |
readr |
sample.csv |
Preparation
<- readr::read_csv("C:/data/sample_parcel_land_sizes.csv") df
Sample Instructions
function(data, number)
Actual Instructions
head(df, 100)
5.2.3 Preview all rows of a dataframe
Description | |
---|---|
Method to visually inspect all rows of a dataframe |
Ingredients | |
---|---|
Package | Data |
readr |
sample.csv |
Preparation
<- readr::read_csv("C:/data/sample_parcel_land_sizes.csv") df
Sample Instructions
data
Actual Instructions
df
5.2.4 Preview all rows of a dataframe within a viewer
Description | |
---|---|
Method to visually inspect all rows of a dataframe |
Ingredients | |
---|---|
Package | Data |
readr |
sample.csv |
Preparation
<- readr::read_csv("C:/data/sample_parcel_land_sizes.csv") df
Sample Instructions
function(data)
Actual Instructions
View(df)