Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Create a function
- check_it <- function()
- if(x>500){
- return("green")
- } else if(x<0) {
- return("red")
- } else {
- return("blue")
- }
- # Create a loop using check_it
- for(x in 1:nrow(all_data)) {
- # Given this hint
- # Hint: You can use 1:nrow(all_data) as a set of indices
- # to do something like the following inside the loop:
- # all_data[i, "color"] <-
- # check_it( all_data[i, "growth"] )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement