MATH 223 Lecture Notes - Lecture 10: Scatter Plot, Summary Statistics, Working Directory

9 views4 pages
Use the dataset “Food Nutrition” and answer the following questions:
1. Set the working directory for your work
2. Import the dataset in the console in the .xls(x) format
3. View the top 10 rows of the data
4. View the last 20 rows of the data
5. Show the summary of the data
6. Create a vector “test” using the top 10 values of variable Protein_(mg)
7. Select the top 5 rows of initial 5 variables in a matrix format
8. What is the class of the Sodium_(mg) variable
9. Create a new variable “EPW” by dividing Energ_Kcal with the Water; what is the
dimension of the new dataset?
10. Create a subset of the dataset, where the Energ_Kcal is less than 500, what is the
dimension of this new dataset?
11. Plot a Scatter Plot between Enrg_Kcal and Water using the new subset created
12. Plot a histogram of Sugar_tot variable using the new subset
13. Find the top 10 products based on following
1. Higher the Energy_Kcal, higher the ranking
2. Lower the water content, higher the ranking
14. Create a subset of the data where product_desc contains “CHEESE” and list down
the summary statistics of the subset
15. Using the cut function on water variable divide the whole data into 6 bins, list down
the summary statistics of all the 6 bins
#set directory
#install package
#read excel
req_data_f<-read_excel("Food Nutrition.xlsx")
Unlock document

This preview shows page 1 of the document.
Unlock all 4 pages and 3 million more documents.

Already have an account? Log in

Get OneClass Notes+

Unlimited access to class notes and textbook notes.

YearlyBest Value
75% OFF
$8 USD/m
$30 USD/m
You will be charged $96 USD upfront and auto renewed at the end of each cycle. You may cancel anytime under Payment Settings. For more information, see our Terms and Privacy.
Payments are encrypted using 256-bit SSL. Powered by Stripe.