################################################## ## Homework 1 ## Intro to R Part 1: Getting Started ## ## Copy-paste this file into a new R script. ## Then type your answer below each prompt. ################################################## ## Q1. Create a numeric vector called `x` with 1000 numbers. You can use any ## function or operator of your choice. ## Q2. Use `length()` to verify that `x` has exactly 1000 elements. ## Q3. Compute the mean, minimum, maximum and range of `x`. ## Q4. Write an expression that returns the 5th element of `x`. ## Q5. Write an expression that returns the 6th through 10th elements of `x`. ## Q6. Create a character vector containing the names of your top-three favorite flavors of ice cream. ## Q7. Write an expression that returns a vector containing the ## FIRST 10 UPPERCASE letters of the alphabet. ## Q8. Write an expression that returns a vector containing the ## LAST 5 LOWERCASE letter of the alphabet. ## Q9. Write an expression that returns a vector containing the EVEN numbers ## from 1 to 20 (i.e., 2, 4, 6, 8, ..., 20). ## Q10. Write an expression that returns a vector containing the ODD numbers ## from 1 to 20 (i.e., 1, 3, 5, 7, ..., 19). ## Q11. Generate 100 random numbers using `rnorm()`, saving the results to an object called `my_nums`. ## Q12. Write an expression that returns the elements of `my_nums` that are greater than 1. ## Q13. Write an expression that tells you HOW MANY elements of `my_nums` are greater than 1. ## Q14. Write an expression that returns the current date.