Instructions

Exercise 1: Logical Operators

In what follows, use relational and logical operators to determine if the statements provided are true or false. You will be evaluated on whether the statement correctly represents the question asked.

  1. Is the value of speed below the limit of 70 MPH?
## [1] TRUE
  1. Is the variable gender equal to “Male”? Feel free to modify the value of gender to verify that your logical statement gives the right outputs.
## [1] FALSE
  1. Is the value of x to the 5-th power between or equal to 0.5 and 1? Feel free to modify the values of x to verify that your logical statement gives the right outputs.
## [1] TRUE
  1. In order to control a flight, we need to ensure that the speed remains between 550MPH and 600MPH. We also need to ensure that the altitute is between 31,000 and 42,000 feet. Create a logical statement to verify if a flight is within normal conditions (TRUE) or in abnormal conditions (FALSE). Feel free to modify the values of speed and altitude to verify that your logical statement gives the right outputs.

(Hint: if you want, you can break the problem in several steps)

## [1] FALSE
## [1] TRUE
  1. A voltage system needs to remain within the limits 10V to 20V to remain functional. If the voltage falls outside of the range, the system needs to perform corrective actions. Create a logical statement that returns TRUE if the voltage is outside of the functional range, and FALSE if it is inside of the functional range. Feel free to modify the values of voltage to verify that your logical statement gives the right outputs.
## [1] TRUE

Exercise 2: Importing Data in R

A very common type of data are comma separated values (CSV). They can be imported to R through the function read.csv().

  1. Use the command ? to learn more about the function read.csv().
## No documentation for 'read.csv()' in specified packages and libraries:
## you could try '??read.csv()'
  1. Whenever you want to import a dataset, you must ensure that the working directory is in the location where the data file is. Checking previous lectures or searching in google, find a function that tells you what is the current working directory in R.

In the following chunk, use the function you found to print your current working directory to ensure it is at the directory of this Rmarkdown location.

  1. Use the function read.csv() to import the dataset satData.csv. This dataset contains the average SAT scores for all counties in North Carolina. Print the names of the columns, and the column variable types.

  2. Calculate the mean value of all SAT math scores in the dataset.