Automated-Learning and Data Analysis homework;Solution

$30.00 $24.00

Programming related instructions Carefully read what function names have been requested by the instructor. In this homework or the following ones, if your code does not follow the naming format requested by the instructor, you will not receive credit. For each function, both the input and output formats, as well as an example will be…

5/5 – (2 votes)

You’ll get a: zip file solution

 

Description

5/5 – (2 votes)

Programming related instructions

Carefully read what function names have been requested by the instructor. In this homework or the following ones, if your code does not follow the naming format requested by the instructor, you will not receive credit.

For each function, both the input and output formats, as well as an example will be provided. Please ensure that you follow the correct input and output formats.

Apart from library functions (library/require), seed function, comments and function de nitions, your code le should not contain any other function calls/code. If you wish to verify the correctness of your functions, do so in another le which does not need to be submitted. You are welcome to write your own helper sub-functions, but they should be called from within the TA-requested functions only.

DO NOT set working directory (setwd function) or clear memory (rm(list=ls(all=T))) in your code. TA(s) will do so in their own auto grader.

The TA will have an autograder which will rst run source(hw0.R), then call each of the functions requested in the homework and compare with the correct solution.

Your code should be clearly documented.

Software Installation

The TA(s) will be using the following software throughout the course unless otherwise stated.

R Version: R version 3.6.2 (2019-12-12) { “Dark and Stormy Night”

Operating System: Ubuntu 18.04 or MacOS

1

ALDA { Spring 2020 Homework 0

R IDE: R Studio Desktop (free version)

If you do not already have the version of R and R Studio speci ed above, download and install them on your machine. If you already have an older version of R that you do not wish to update, we recommend setting up a virtual machine with the operating system speci ed above. If you are facing trouble installing R or RStudio, visit the TAs during their o ce hours. Ensure that the packages you use are compatible with the given version of R.

Learning Goals

By the end of this exercise, you should:

have installed all the necessary softwares required for this course homeworks. have explored R data types and data structures.

be able to create functions in R based on user requirements. have explored visualization techniques in R.

be able to create executable code in R.

be familiar with submitting programming assignments for this course.

Problems

  1. (Yang Shi) In this homework, you will be creating two functions named intro to r and intro to plotting. You are already provided hw0:R template. Using the information provided below, complete the func-tions in the template. The input, output arguments and their types as well as function requirements have been discussed below. (Note the lower case notation). The variable names and types are given the format [variable name : data type]. Read up on the di erence between vectors, lists, named lists and data frames in R before you start this problem.

Note 1: double vector means a vector of type double.

Note 2: set seed to 321.

    1. intro to r: Create a function called intro to r which will take an input (num values). Your function should create a random vector of size num values named new vector and should calculate the mean (new mean), median (new median), max (new max) and min (new min) values of this vector. You will then return a list in the following order [new vector, new mean, new median, new max, new min]. Input and output data types are described in further detail below.

Input: num values : integer

Output: a list: [new vector : double vector, new mean : double, new median : double,

new max : double, new min : double]

Example: intro to r(10) should generate a random array of size 10 and of type double, calculate its mean, median, max and min and return these values in the format speci ed above.

    1. intro to plotting: Create a function called intro to plotting which will take an input (num values). Create a random vector of size num values named new vector. Using new vector, generate two plots as shown below. Use the ggplot2 package for plotting.

      1. Plot 1: Scatter plot with new vector on x-axis and new vector on y-axis. Programmatically save this plot as teamID plot01:pdf

      1. Plot 2: Scatter plot with new vector on x-axis and new vector2 on y-axis. Programmatically save this plot as teamID plot02:pdf

Example: intro to plotting(100)

  1. You are allowed to use the prede ned functions de ned in R Base and ggplot2 for random array generation, max, min, mean and median and plotting operations.

2

Automated-Learning and Data Analysis homework;Solution
$30.00 $24.00