Question: 1 . Consider the ` POPULATION ` data frame. a . Filter for all observations within the ` State ` variable with a value of
Consider the POPULATION data frame.
a Filter for all observations within the State variable with a value of Indiana. Save this variable into an object called INDIANA. Print the first rows.
b Using the INDIANA data frame, use the pivot longer function to make the data set into long form. All of the year columns XX should become one column while all the values should become another column. Choose appropriate names for the variable name. Save the long form data set into an object called INDIANALONG Sort by the variable "POP". Print rows
iExtra Point Remove the X at the beginning of each variable name within the pivotlonger function using extra arguments. Adding extra functions to remove X will not grant the extra point.
c Turn the INDIANALONG data frame back into wide format using pivotwider. Call this data frame INDIANAWIDE Print the ten largest populations only in in order from largest to smallest.
This question requires no code, but include writtentyped responses to the following in your RMarkdown PDF output:
Dataset A has unique ID rows of data and dataset B has unique ID rows of data. Dataset C has rows of data but only unique IDs.
a If you were to left join dataset A and B by ID how many rows would the joined dataset have?
b If you were to right join dataset A and B by ID how many rows would the joined dataset have?
c If you were to left join dataset A and C by ID how many rows would the joined dataset have?
d If you were to right join data B and C by ID how many rows would hte joined dataset have?
e Name the three requirements satisfied by tidy data.
Consider the DRINKS data set.
a Filter to only contain data from the countries of USA, China, and Italy.
b Remove the totallitresofpurealcohol variable, and rename the following columns: beerservings to beerspiritservings to spirit and wineservings to wine
c Converts the new subset from wide format to long format.
i Convert the variables column names into a columns named type while the numerical values are a variable called servings
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
