Reference no: EM132310458
Introduction to Data Analytics for Business Assignment - R Basics
Create R scripts to complete the following tasks.
Note: prepare your answers in a R script file (xxx.R) and submit the file.
[Q1 - Q6] Based on 'R Workshop.R' posted on the Blackboard course website and covered in class, prepare R scripts to complete the following tasks:
Q1. Install the "ggplot2" package and load it in the current R session. Also, get details regarding contents of "ggplot2" package.
Q2. Assign the value of the circumference and the size of a circle with radius being 10 to variable 'cc' and 'sc', respectively. Evaluate the value of 'cc' and 'sc' up to 5 digits at the command line.
Q3. Create objects that presents the following outputs on the console:
(1)
[1] "Mon" "Tue" "Wed" "Thur" "Fri"
(2)
[[1]]
[1] 1
[[2]]
[1] "hello"
[[3]]
[1] FALSE
(3)
|
ID
|
Name
|
Gender
|
Weight
|
1
|
1
|
Sam
|
M
|
75
|
2
|
2
|
Tom
|
M
|
65
|
3
|
3
|
Jane
|
F
|
70
|
4
|
4
|
Susan
|
F
|
60
|
Q4. Get the following outputs from the object created in 3. (3) above:
(1) All rows and the first 2 columns.
(2) Rows where Weight is greater than 65 and all columns.
(3) Rows where Weight is greater than 65, and 'Name' and 'Weight' columns.
Q5. Add a variable named 'Wcat' into the object created in 3. (3) above, so that the revised object will look like below (Wcat = "heavy" (Weight > 70), "normal" (60 < Weight <= 70), "light" (Weight <= 60):
|
ID
|
Name
|
Gender
|
Weight
|
Wcat
|
1
|
1
|
Sam
|
M
|
75
|
heavy
|
2
|
2
|
Tom
|
M
|
65
|
normal
|
3
|
3
|
Jane
|
F
|
70
|
normal
|
4
|
4
|
Susan
|
F
|
60
|
light
|
Q6. Now you are going to analyze a dataset named 'iris' available from the {datasets} package. Examine some key characteristics of the dataset, including its look, data structure, variables and summary statistics.
[Q7 - Q10] Based on 'QuickR_CreatingGraph.R' posted on the Blackboard course website and covered in class, prepare R scripts to create the following graphs:
7. Histogram and density plot
8. Dotplot
9. Bar plot and pie chart
10. Boxplot and scatter plot.
Attachment:- Assignment File.rar