10000 solution for first notebook · jaeyk/R-functional-programming@c42c6c7 · GitHub
[go: up one dir, main page]

Skip to content

Commit c42c6c7

Browse files
committed
solution for first notebook
1 parent b4a4d93 commit c42c6c7

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

solutions/01_solutions.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
## Why Functional Programming Solutions
2+
3+
### Challenge 1
4+
5+
Explain why this solution is not very efficient. (e.g., If `df$a[df$a == -99] <- NA` has an error, how are you going to fix it?)
6+
7+
**Answer** A solution is not scalable if it's not automatable and, thus, scalable.
8+
9+
### Challenge 2
10+
11+
Why is using function more efficient than 100% copying and pasting? Can you think about a way we can automate the process?
12+
13+
**Answer** There are multiple reasons. Functions use less code overall, reducing the amount we type and have to debug. Functions can be reused, allowing us to scale and automate a process.
14+
15+
### Challenge 3
16+
17+
If you run the code below, what's going to be the data type of the output?
18+
19+
20+
```{r}
21+
22+
map_chr(df, fix_missing)
23+
24+
```
25+
26+
**Answer** The code will return a named character vector of NAs
27+
28+

0 commit comments

Comments
 (0)
0