####ISTA 116 Homework 0 Draft 2#### # # # #
# # Welcome to ISTA 116! This document is designed to help you get familar with # the fundamentals of R, and to understand how we expect future assignments to # be submitted. If you're confused or have quetions, now is a great the time to # ask or email your section leader. Don't wait until the last minute; we'll be # building on these basics all semester long! # # In addition to being informative and entertaining to human readers, this document # is actually a full-fledged R script, which means R can open and interpret the it # (or at least parts of it) as instructions that the R environment can understand. # To that end, we will require many of your upcoming homework assingnments # to be turned in as a properly-formatted R script file. # # The homework assignments will be a combination of problems drawn from the lectures, # and problems that use the R tools. Don't worry if R seems intimidating at first; # we aren't expecting you to become computer scientists (or statisticians!) # overnight. We'll be easing you into using the software. # For now, there are a few important things you should know about R script files. # First of all, they are designed to be interpreted by the R software. This means # that everything you write in an R script needs to be in the "language" of R. # R uses a strict grammar that looks nothing like english, but does look a lot like # math. For example, R understands an expression like: 2+2 # perfectly well. In fact, if you run this R script, it will scan through the file, # line by line, and when it gets to the line that says "2+2", it will evaluate that # expression and display the result on the next line. Pretty cool, huh? No, not # really? Well, fine, but all programmers have to start somewhere! # # Perhaps you've noticed that most of the lines in this file have a # symbol at the # beginning. This number sign, or pound sign, or tic-tac-toe sign has a simple # purpose. It tells R to ignore the rest of the line. Programmers call lines that # begin with this symbol "comments" as they can be used to explain code in plain # english. Any line with a # at the start does not have to be in R's "language." # So, when we say that some of your answers will be "submitted as comments," or # that a line of your homework should be "commented out" we simply mean that you # should put a # at the start of the line(s) in question. # # Some parts of homework assignments will require you to write your answers as # comments. Other parts of the homework will require actual R code. # # In this class, we'll be giving you a fill-in-the-blank R script for each homework. # Some sections (where we expect plain english answers) will be marked with the # # symbol. Others will require you to write in a few lines of R code that will # instruct R to display an answer (or sometimes a graph). # # To get full credit for this homework, all you need to do is put in your name, # section leader, and section meeting time at the very top of the script, and # answer me these questions three: # #### 1. What is the R command to add five and ten? #### (Type your answer below)#### #### 2. What is your favorite color? #### (Type your answer as a comment below) # # # #### 3. Once you have completed the above two questions, run the #### script on your computer before you submit it on D2L. Does it #### function as expected? Are there any errors? #### (Type your answer as a comment below) # # # # If you have errors, you may simply have forgotten to # put a # at the beginning of a line intended to be a comment. # Otherwise, ask or email your section leader for help. # # Please check all future homework submissions for errors # by running them before submitting, to ensure you receive credit # for your work!