Hi everyone,
I was working on the project, “Day of the Race” in the Introduction to Programming in R section of the Skill Path Analyze Data with R (https://www.codecademy.com/paths/analyze-data-with-r/tracks/introduction-to-programming-in-r/modules/intro-to-programming-in-r/projects/day-of-the-race-project-R). I tried to set up the function according to the cheat sheets and trying to sort through a vector of names, but I am still not getting output from my function. So far, I have the following lines of code to a) create the function and b) call the function:
find_place <- function(runner){
place <- 1;
for(racer in race_results){
print(racer)
if(runner==racer){
return place
}
place <- place + 1
print(place)
}
return place
}
```{r}
# call and apply find_place() here:
place_of_person <- sapply("Francesca", find_place)
place_of_person
...
But I still do not get any output. Is there something in the loop that I am not referencing? I tried to use the HINT to correct my structure, but I still was unable to find success.
Thank you in advanced :slight_smile: