This practice set is modeled off of Lab 4 (and things you may have learned so far). For this assignment, you will use the travel details dataset which can also be found here. As you may have noticed, kaggle is a cool resource to import data from to build on your coding skills.
Part 1.
Load packages you may need for this assignment. Then read in the file, again remember R will use the default sep argument so you need not specify anything in your code. Assign this df to ‘travel’.
Part 2.
Rename any 3 variables of your choice and re-assign the df to ‘travel’. Use pipes.
Group by nationality and calculate the mean trip duration and mean traveler age.
Create a new variable such that you can divide accommodation cost as ‘costly’ and ‘cheap’. For example, you could choose a threshold of $1000 for the trip cost. Use the mutate function with if_else to do so. Read up the documentation on it if you can to do so.
Create a contingency table for gender and transportation type (cross-tab). Use the table function learned in lab 1 do so. Next, you can also calculate percentages for the same using the function ‘prop.table’. Wrap table within the prop.table function to do so. Use the help function to learn more about how it can be used.