Exercise 1
For this exercise, we will be working with the surveys.csv data set.
surveys.csv into R using read.csv() and assign it to an object called surveysselect() to create a new data frame object called surveys1 with just the year, month,
day, and species_id columns in that order.surveys2 with the year, species_id, and a new column called weight_kg that contains the weight in kilograms of each individual, with no null weights. For this, you can use mutate(), select(), and filter() with the option !is.na(). The weight in the table is given in grams so you will need to create a new column called weight_kg for weight in kilograms by dividing the weight column by 1000.filter() function to create a new object called surveys3 that has all of the rows in the data frame surveys1 for the species ID “SH”.
How many rows does the resulting table has?head() or str() to display your resulting tables.