R
brush-upmyprint(2)
## [1] 2
for
loopdata.frame
:first_name | last_name | gender |
---|---|---|
Hermione | Granger | female |
Ron | Weasley | male |
Harry | Potter | male |
Write a function that takes such a data.frame
as a argument and that will print the last name for each row.
while
statement Now write the same function using a while
statement.
if
/else
statetement
Finally, write a function that will print the last name for females and the first name for males
There are only two hard things in Computer Science:
- cache invalidation, and
- naming things.
– Phil Karlton