Question 8 A data analyst is working with a data frame named stores. It has separate columns for city (city) and state (state). The analyst wants to combine the two columns into a single column named location, with the city and state separated by a comma. What code chunk lets the analyst create the location column

Respuesta :

fichoh

The programing language, R has a unite unite function in the tidyr package. Hence, the code chunk which let's the analyst create the location column is; unite (stores, "location”, city, state, sep=",")

  • The syntax for the unite function is ; unite(data,col,..., sep)

  • data = dataframe from which data is to be extracted `; stores
  • col = name of the new column ;" location"
  • ... = dataframes to be merged ; city, state
  • sep = seperator ; ","

Hence, the required syntax goes thus :

  • unite (stores, "location”, city, state, sep=",")

Learn more : https://brainly.com/question/25534959