STAT311-HW0-Writeup

pdf

School

University of Washington *

*We aren’t endorsed by this school

Course

311

Subject

Statistics

Date

May 26, 2024

Type

pdf

Pages

3

Uploaded by GrandFlag10766

Report
4/3/24, 11:20 PM Writeup Assignment 0 file:///Users/sarajduan/Desktop/stat 311/STAT311-HW0-Writeup.html 1/3 Writeup Assignment 0 Author 2024-04-03 Please complete the following: Address any questions or code below. Compile the document into a PDF file. The PDF file must be multiple pages - if your file is a single page, try compiling to an HTML, opening in your browser, and printing the page to a PDF. Submit to Gradescope. Paginate individual questions correctly, selecting which pages each question pertains to, or your assignment will not be graded and will require resubmission. HW0 Programming Assignment For writeup assignments that build upon the programming assignments, you will need to execute some of the homework code within the RMarkdown file. Copy all of your code from Assignment 0 into the block below.
4/3/24, 11:20 PM Writeup Assignment 0 file:///Users/sarajduan/Desktop/stat 311/STAT311-HW0-Writeup.html 2/3 #Paste your entire HW0 Programming assignment code here # PART 1 # Create a vector of length 5 with values 1, 2, 3, 4, 7 # Call it "myVector" myVector <- c(1, 2, 3, 4, 7) # PART 2 # Create a string containing your name # Call it "myString" myString <- "Sara Duan" # PART 3 # Read the "Tips for troubleshooting autograded programming submissions" # post on EdStem and find the hidden value for HW0. # Call it "HW0P3" HW0P3 <- 724 # PART 4 # The following code will not run correctly; fix it # without changing the values or variable names. thisVariable <- pi^2 thisVector <- c(thisVariable, thisVariable) # PART 5 # Create a function that takes a single variable and # returns a vector of length 3 equal to the sum # of the rows of a 3x3 matrix or dataframe # Call it "myFunction" myFunction <- function (input){ if (is.matrix(input) || is.data.frame(input)) { row_sums <- rowSums(input) return (row_sums) } else { return (NA) } }
4/3/24, 11:20 PM Writeup Assignment 0 file:///Users/sarajduan/Desktop/stat 311/STAT311-HW0-Writeup.html 3/3 Including Graphics When importing data for writeup assignments you are free to change code that loads data, such as changing the file name or folder address. The code below imports a dataset about the number of rental bikes in use each hour for a random set of hours over a two year span. The data is saved in the data frame , under the variable name . Using the function , create a histogram of of the bike rentals. Utilizing , find the optional function arguments to do the following: Plot a histogram of the data Plot a density, rather than frequency histogram Change the main title of the plot to something more appropriate Change the x axis of the plot to something more informative bikes<-read.csv("BikeRentals.csv") hist(bikes$rentals, freq = FALSE, main = "Density of Bike Rentals", xlab = "Number of Bi ke Rentals")
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help