Write a R function that uses the Olympic database to print out the names

others

Description

 Write a R function that uses the Olympic database to print out the names 
# of all athletes that won medals of choice in an Olympic sport. The printout  
# provides the name of the athletes, the year of the  Olympics, the medal achieved
# the sport and the country of their origin.
#
# You are limited to using conditional and control flow methods (if statements, loops, 
# logical and relational operators). You cannot use the tidyverse technique in this task.  
# Turn your algorithm into a function so that we can use it for other sports and 
# any of three medals (Gold, Silver or Bronze).  The function should have three or less
# arguments.

# Hints: 
# 1) Cut the data frame down in size (less rows) to practice on a smaller 
#       set of inputs; 
# 2) Create a script that works for say (sport = "Cycling" and medal = "Gold");
# 3) Once it works, wrap the script into a function syntax;
# 4) Make the sport and medal functional arguments;
# 5) You could import the data frame within the function;
# 6) Within the function, consider using the "which()" function that results in 
#       an index for selecting rows (that is, the sport and medal of choice);
# 7) Perhaps use a "for loop" that will iterate through the index.  This can help 
#       to identify other elements in the same row (i.e., name of athlete, year, country); 
# 8) Use the print(paste()) combination to print out your results.  
# 9) The function should work when the data and the script are in the same folder;
# 10) Of course, there are many ways that will work to create this output. Please don't
#       be shy to use your own creativity!   


Instruction Files

Related Questions in others category


Disclaimer
The ready solutions purchased from Library are already used solutions. Please do not submit them directly as it may lead to plagiarism. Once paid, the solution file download link will be sent to your provided email. Please either use them for learning purpose or re-write them in your own language. In case if you haven't get the email, do let us know via chat support.