Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | Next revision Both sides next revision | ||
r_workshop5 [2018/11/14 16:28] katherinehebert [for loop] |
r_workshop5 [2018/11/14 16:29] katherinehebert [for loop] |
||
---|---|---|---|
Line 289: | Line 289: | ||
</code> | </code> | ||
- | Tip1. To loop over the number of rows of a data frame, we can use the function ''nrow()'' | + | **Tip 1.** To loop over the number of rows of a data frame, we can use the function ''nrow()'' |
<code rsplus> | <code rsplus> | ||
Line 297: | Line 297: | ||
</code> | </code> | ||
- | Tip2. If we want to perform operations on the elements of one column, we can directly iterate over it | + | **Tip 2.** If we want to perform operations on the elements of one column, we can directly iterate over it |
<code rsplus> | <code rsplus> | ||
Line 305: | Line 305: | ||
</code> | </code> | ||
- | The expression within the loop can be almost anything and is usually a compound statement containing many commands. | + | **Tip 3.** The expression within the loop can be almost anything and is usually a compound statement containing many commands. |
<code rsplus> | <code rsplus> |