Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The file Amazon Top30.txt is a tab delimited file containing information on the 30 highest selling books on Amazon.com over the course of 2020. The
The file Amazon Top30.txt is a tab delimited file containing information on the 30 highest selling books on Amazon.com over the course of 2020. The included variables are: Rank: The book's rank for 2020. Title: The title of the book. Author: The book's author. Two author values which are missing are indicated using a period (.). Rating: The average customer review score, out of 5. Reviews: The number of customer ratings. Note that these values include commas. Price: The price of the book on 2/10/2020. Note that these values include dollar signs (). Genre: Whether the book is Fiction, Nonfiction, or an Activity book. Format: Whether the book is a Hardcover, Paperback, or Board book. Release: The release date of the original version of the book. Complete each of the following in R. (a) Import Amazon Top30.txt into R such that the periods are treated as missing. Alter both the Reviews and Price variables so that they are treated as numeric (using gsub()). Print the resulting data frame and report the output. (b) Export the data frame created in part (a) to a comma delimited file such that the missing values in the Author variable are stored as underscores (-). Do not include the row names in the exported file. Call the file TopBooks.txt. Upload this file when submitting your work. Baltimore MD $10.95 Brooklyn NY $12.99 Buffalo NY $11.50 Harlem NY $12.50 Newark NJ $11.50 Rochester NY $10.95 Stamford CT $11.50 Syracuse NY $10.95 Troy NY $11.50 The file Amazon Top30.txt is a tab delimited file containing information on the 30 highest selling books on Amazon.com over the course of 2020. The included variables are: Rank: The book's rank for 2020. Title: The title of the book. Author: The book's author. Two author values which are missing are indicated using a period (.). Rating: The average customer review score, out of 5. Reviews: The number of customer ratings. Note that these values include commas. Price: The price of the book on 2/10/2020. Note that these values include dollar signs (). Genre: Whether the book is Fiction, Nonfiction, or an Activity book. Format: Whether the book is a Hardcover, Paperback, or Board book. Release: The release date of the original version of the book. Complete each of the following in R. (a) Import Amazon Top30.txt into R such that the periods are treated as missing. Alter both the Reviews and Price variables so that they are treated as numeric (using gsub()). Print the resulting data frame and report the output. (b) Export the data frame created in part (a) to a comma delimited file such that the missing values in the Author variable are stored as underscores (-). Do not include the row names in the exported file. Call the file TopBooks.txt. Upload this file when submitting your work. Baltimore MD $10.95 Brooklyn NY $12.99 Buffalo NY $11.50 Harlem NY $12.50 Newark NJ $11.50 Rochester NY $10.95 Stamford CT $11.50 Syracuse NY $10.95 Troy NY $11.50
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started