Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

Problem 1: Use R to write a for-loop that prints the following output: 1 3 5 7 9 11 Write a while loop that prints

Problem 1: Use R to write a for-loop that prints the following output:


1
3
5
7
9
11

Write a while loop that prints the same output as the for-loop for Problem 1.

Write an if-statement nested inside your for-loop from Problem 1 that prints "three" instead of the output "3", so that the output becomes:


1
“three”
5
7
9
11

 Write a function called summarystat, which returns the mean, median, and standard deviation for both of these vectors, with labels. For example, using this function on the Tail_wags vector should have similar output to:

> summarystat(Tail_wags)

[1] "Mean" = 8.7273"

[2] "Median = 12"

[3] "Standard Deviation = 6.4976"

Run the function on both the Tail_wags and Dog_biscuits vectors. Try to enhance the output if you can, making it easier to read. (Example: round the calculations to a few decimal places, etc.)


 Use the Loblolly dataset to write a function that creates a scatterplot of height and age based on a specified seed number.


1 > Loblolly height age Seed 4 .51 3 301 15 10.895 301 29 28.72 10 301 43 41.74 15 301 57 52.70 20 301 71 60.92 25 301 2 4.55


An example of what the output should look like is below:

Scatterplot of Seed 301 20 25 15 Age 10 01 10 20 30 40 50 60 Height  

 

> Loblolly height 4.51 age Seed 1 3 301 15 10.89 5 301 29 28.72 10 301 43 41.74 15 301 57 52.70 20 301 71 60.92 25 301 2 4.55 3 303 16 10.92 5 303 30 29.07 10 303 44 42.83 15 303 58 53.88 20 303 72 63.39 25 303

Step by Step Solution

3.45 Rating (161 Votes )

There are 3 Steps involved in it

Step: 1

1 vseq1112... blur-text-image
Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Java Concepts Late Objects

Authors: Cay S. Horstmann

3rd Edition

1119186714, 978-1119186717

More Books

Students explore these related Accounting questions