Question: In Statistical Program R Part 1: Create a vectorized function that takes the last name and the sex (M/F) of a customer and returns a

In Statistical Program R

Part 1: Create a vectorized function that takes the last name and the sex ("M"/"F") of a customer and returns a customized greeting. To that aim, create a new variable `salutation` that has values `Mr.` or `Ms.` based on the participant sex in your function. Then return a greeting text that contains the salutation and the name.

Part 2: Then apply your greeting function to the variables in customers data frame below:

names <- c("Smith", "Miller", "Jones", "Brown", "Moore", "Jackson")

sex <- c("F", "M", "M", "F", "F", "M")

customers <- data.frame(names, sex)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!