0% found this document useful (0 votes)
18 views1 page

Main R

The document outlines a series of steps to analyze the 'mtcars' dataset in R. It includes loading the dataset, displaying its summary and structure, viewing the first and last six rows, and counting the number of columns and rows. Some steps are specific to RStudio functionality.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views1 page

Main R

The document outlines a series of steps to analyze the 'mtcars' dataset in R. It includes loading the dataset, displaying its summary and structure, viewing the first and last six rows, and counting the number of columns and rows. Some steps are specific to RStudio functionality.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

# Step 1: Load the built-in dataset

data <- mtcars


cat("Dataset 'mtcars' loaded.\n")

# Step 2: Display summary of the dataset


cat("\nSummary of dataset:\n")
print(summary(data))

# Step 3: Display structure of the dataset


cat("\nStructure of dataset:\n")
str(data)

# Step 4: View the dataset (works only in RStudio)


# View(data)

# Step 5: Display first 6 rows


cat("\nFirst 6 rows of dataset:\n")
print(head(data))

# Step 6: Display last 6 rows


cat("\nLast 6 rows of dataset:\n")
print(tail(data))

# Step 7: Number of columns


cat("\nNumber of columns in dataset:\n")
print(ncol(data))

# Step 8: Number of rows


cat("\nNumber of rows in dataset:\n")
print(nrow(data))

# Step 9: Edit the dataset (works only in RStudio)


# edit(data)

You might also like