-
Notifications
You must be signed in to change notification settings - Fork 5
/
possible_dog_part3.R
33 lines (26 loc) · 1.04 KB
/
possible_dog_part3.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
### Beginner Task ###
# Read this code and see if you understand what it does and why.
# Try changing the return to see what it does!
# Discuss what changes you made with other group members.
# https://www.guinnessworldrecords.com/news/2019/4/a-history-of-the-biggest-and-smallest-dog-breeds-from-giant-great-danes-to-tiny
dogCheck <- function(height_cm, has_fur) {
params <- paste0("Fur:", has_fur, ", Height (cm):", height_cm)
if(has_fur == TRUE){
if(height_cm < 112 & height_cm > 9){
possible_dog <- TRUE
}
} else {
possible_dog <- FALSE
}
return(list("Dog Parameters" = params, "Possibly a Dog" = possible_dog))
}
dogCheck(height_cm = 50, has_fur = TRUE)
### Advanced Task ###
# Begin with the function you created in Part 1 and 2.
# If you haven't already, change the output your function will return.
# Can you make your function return two items? Remember that R does not allow multi-argument returns.
# If you have time, explain your code to other group members.
myFunction <- function(){
return()
}
myFunction()