Problem 1

Every object in your Environment is stored in:

Problem 2

If you run the following line of code, what will be the class of the resulting object:

x <- "2017-01-01"

Problem 3

What command is used to combine values into a vector?

Problem 4

If I have a list object named myList, how do I access the first object of the list?

Problem 5

Download and read in the THOR data set at the link below (note: this file is large and will take a bit to download). How many rows of data are in this data set (don't use any commas)?

Download

Problem 6

How many missions were flown by the A4 aircraft (hint…to answer this question, use the AIRCRAFT_ROOT field)?

Problem 7

What is the average (mean) number of aircraft per mission (use the NUMOFACFT field)?

Problem 8

How many times did 'F4' Aircraft target 'THERMAL POWER PLANT'? (hint, use TGTTYPE and AIRCRAFT_ROOT)?

Problem 9

How many missions had a WEAPONTYPEWEIGHT greater than 2000 lbs?

Problem 10

How many mission had a TIMEOFFTARGET that occurred after 1000 but before 1200 (noon)?

Problem 11

How many missions have a WEAPONTYPE that has “INCEN” anywhere in the name (meaning they were 'indendiary' weapons)?

Problem 12

Plot the histogram of the TIMEONTARGET. Did more missions occur before noon or after noon?

Problem 13

Use the lubridate package to convert the MSNDATE field to a date class vector. Plot a histogram of this vector. When was the highest volume of missions:

Problem 14

Create a barplot of the MILSERVICE field. Which of the following serices had the 2ND highest number of missions:

Problem 15

Using the following code, answer the questions below:


letters <- c("a", "b", "c", "d", "e", "f")

for(i in 1:length(letters)){
 if(i==2 | i==3) {
 next
 }
 print(letters[i])
}

What letters will this print out?

Problem 16

Using the following code, answer the next TWO questions below:


y <- 26

while(y >= 0){
 y <- y - 1
}

What is the value of y when this loop finishes running?

Problem 17

Looking at the code above, how many loops (or iterations) will this code take to run (hint…if you're struggling to mentally calculate it, copy and paste it into RStudio and add a count variable to keep track of iterations)?

Problem 18

x <- c(5, -2, 9, 5, 7, -3, 4, 10, 4)

I want to set all elements of this vector that are less than 0 to the value of 0. What R code achieves this?

Problem 19

Using the following code, answer the questions below:

df <- data.frame(a = c(1, 2, 3, 4, 5),
                  b = c(6, 7, 8, 9, 10))

Provide the SINGLE line of code that will create a column named “c” in this data frame that is the sum of coulumn “a” and column “b”:

Problem 20

The creators of R were from what country (you may need to use Wikipedia for this question)?