Question: # Write a function ` has _ more _ zs ` to determine which of two strings contains # more instances of the letter

# Write a function `has_more_zs` to determine which of two strings contains
# more instances of the letter "z". It should take as parameters two string
# variables, and return the argument which has more occurances of the letter "z"
# If neither phrase contains the letter "z", it should return:
# "Neither string contains the letter z."
# If the phrases contain the same number of "z"s, it should return:
# "The strings have the same number of Zs."
# The function must work for both capital and lowercase "z"s.
#
# (hint: try googling "stringr count occurances")
# Create a variable `more_zs` by passing two strings of your choice to your
# `has_more_zs` function
# Write a function `remove_digits` that will remove all digits
# (i.e.,0 through 9) from all elements in a *vector of strings*.
# Demonstrate that your approach is successful by passing a vector of courses
# to your function. For example, remove_digits(c("INFO 201", "CSE 142"))
# Vectors ----------------------------------------------------------------------
# Create a vector `movies` that contains the names of six movies you like
# Create a vector `top_three` that only contains the first three movies
# You should do this by subsetting the vector, not by simply retyping the movies
# Using your vector and the `paste()` method, create a vector `excited` that
# adds the phrase -" is a great movie!" to the end of each element `movies`
# Create a vector `without_four` by omitting the fourth element from `movies`
# You should do this using a _negative index_
# Create a vector `multiples_of_4` that is every number divisible by 4
# between 4 and 400(**2 points**)(hint google "r mod divisible")
# Create a vector `multiples_of_8` by filtering your `multiples_of_4` variable
# down to only elements that are divisible by 8.
# Create a vector `numbers` that is the numbers 700 through 999
# Using the built in `length()` function, create a variable `numbers_len`
# that is equal to the length of your vector `numbers`
# Using the `mean()` function, create a variable `numbers_mean` that is
# equal to the mean of your vector `numbers`
# Using the `median()` function, create a variable `numbers_median`
# that is the median of your vector `numbers`
# Create a vector `lower_numbers` that the values in your `numbers` vector
# that are lower than `numbers_mean`(you should do this using vector filtering)
# Create a vector `higher_numbers` that the values in your `numbers` vector
# that are higher than `numbers_mean`(again, using vector filtering)

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!