Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions book/chapters/comments-and-docstrings.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,8 @@ There are **two main approaches**:
1. The `docstring` Package (for inline documentation)

If you want a simple way to add docstrings directly inside your script (without creating an R package), you can use the [`docstring`](https://cran.r-project.org/package=docstring) package.

#### Example


**Example**
```r
library(docstring)

Expand All @@ -117,7 +116,7 @@ There are **two main approaches**:

For R packages, the most common and powerful way to use docstrings is through [roxygen2](https://roxygen2.r-lib.org/). It reads structured comments (starting with #') and automatically generates help files in the man/ directory of your package.

#### Example
**Example**

```
#' Multiply two numbers
Expand Down
20 changes: 9 additions & 11 deletions book/chapters/reusability.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -82,19 +82,17 @@ indexAAG = indexString(myList, 'AAG')

## Think in building blocks!

<div style="display: flex; justify-content: space-around; align-items: flex-start; text-align: center;">
Rather than writing long sequences of code, try to break your pipelines and workflows down into smaller reusable units.
Those "units" can be:

<div style="width:45%;">
<p>Small, cohesive units are much better than...</p>
<img src="../images/tetris.svg" width="80%"/>
</div>
- functions
- classes
- modules
- libraries/packagaes

<div style="width:45%;">
<p>...a customized behemoth!</p>
<img src="../images/tetris_help.svg" width="60%"/>
</div>

</div>
Small, cohesive units are much better than...|...a customized behemoth!
---------------------------------------------|-----------------------
![](../images/tetris.svg){width=50%} | ![](../images/tetris_help.svg){width=90%}

### Exercise

Expand Down