rm(list=ls(all=TRUE)) ## you have to write code below every line that starts with #. Lines that start with ## provide explanations ## R as a calculator # Use the + sign to add 5 and 3 # Use the - sign to subtract 3 from 5 # Use the / to divide 6 by 2 # set the sqrt() function to take the square root of 16 ## Storing results # create an object called mydiff that contains 8-1 # Print the value of mydiff to the console ## Characters and strings # First, save the text "social science" to the variable course # Next, save the text "learning R" to the same variable course # Finally, print the value of course to the console. What do you think it will say? ## Copying and reassigning variables # execute the line below to create the object result result <- 8 - 2 # Assign the value of result to result2 # Overwrite the value of result with 10 - 2 # print result ### Working with Data # Load the data frame UNpop from the file UNpop.csv ## The data provides the world population (in thousands) per year # Print the UNpop data frame # Print the variable names of UNpop ## Print the dimensions of UNpop # Print the number of observations (rows) in this data frame # Print the number of variables (columns) in this data frame # print out the world.pop variable using $ # calculate the mean world population over this time period # print out the world.pop variable for the years 1980 and later (greater or equal to in R: >=; greater than: >) # calculate the mean world population for the years 1980 and later