# DS4100 group coding week 2 # hashtags start the beginning of a comment # the comment runs to the end of the line # 0. determine your current working directory. Set your working directory to another directory # 1. investigate the functions c, data.frame, and setwd with the help function, for example ?c # 2. create a numeric vector named object consisting of the values #1,NA,3,4,67,98,43,NA,NA # 3. create another numberic vector named object2 consisting of the values 1,NA,3,4,67,98,43,NA,13 # 4. Investigate NA, the mode and the length of the 2 vectors, create a factor variable containing the following levels "small", "medium", "large" # 5. combine the 2 numeric vectors into a data frame named frame # 6. install the tidyverse packages using install.packages # 7. access the dataset mpg read about the data #8. determine the average number of city miles per gallon for the data # 9. use the is.na function to find/locate NAs in object and object2 # 10. use the na.omit function to remove the NAs from object and object2 # 11. use the logical function to create a logical vector named tt of length 5 # 12. calculate the sum of object # 13. use the seq function to create the following sequence 5, 10, 15, 20 # 14. learn about the diamonds dataset using the help facility # 15. determine the number of columns and rows in the diamonds data set # dplyr practice # 16. use the select function from dplyr to create a dataframe containing the caret and price column from the diamonds data set # 17. select all columns from the diamonds dataset BUT the x,y,z and price columns # 18. use the filter function to select diamonds with a caret size > .5 # 19. Create at least 2 other filter expressions for diamonds dataset filter(diamonds,x > 4) filter(diamonds, z < 2.5) # 20. write at least 1 filter containing the %in% keyword filter(diamonds, cut %in% c('Ideal', 'Good')) # 21. use the head function with diamonds and the dataframe object frame - notice the difference in the output # 22. use the summary function on the mpg data frame and frame dataframe compare the results