2024-06-10

Report resources

Here are a few useful resources that can be useful when creating a report.

Illustrations

It is on occasion desirable to add an illustration to a report that may either highlight an idea or a concept.

However, it is not always possible to use just any image found on the Internet due to copyright issues.

The following web sites provide free images, illustrations, line art at no charge and without the need of citation.

In fact many illustrations were used from one of these in this document.

Illustrations

Adding and sizing images

Images can be too large and especially for HTML smaller physical and file sizes are desirable and in that case it is better to use an image editor to reduce the file size to start with.

The standard markdown code to add an image in .png, .gif, or .jpg format is simple, for example using the image myimage.png in the current directory or mydir directory.

The square bracket can be left empty or can contain “Alt text” which is shown in the web browser if the mouse is “hovered” over the included image.

Adding and sizing images

  • ![](myimage.png)
  • ![](mydir/myimage.png)
  • ![Alt text here](myimage.png)

By default this notation will present the image “as it is” in its dimensions and there is no figure legend possible.

Fortunately it is possible to control the width (only but the height is deduced) by adding a specification in pixels inside curly brackets connected to the last parenthesis.

For example:

  • ![](myimage.png){width=100px}.

Adding and sizing images

However, in R markdown it may be best to use the knitr::include_graphics() function.

For example:

```{r echo=FALSE, fig.cap="Caption here"} 
### Include image name
knitr::include_graphics("images/myimage.png")
```

The size can also be modified as a function of the output with the out.width = option as shown:

```{r echo=FALSE, fig.cap="Caption here"} 
### Include image name
knitr::include_graphics("images/myimage.png", out.width = 
   if (knitr::is_html_output()) '65%' else '100%')
```

Markdown tables

Creating tables in markdown is not very difficult but it can be time consuming if the table is a bit complicated.

Tableconvert offers conversion between various table formats from files or pasted text.

Table Generator can create empty table to fill.

Table format conversions inclusing Excel and markdown.
Name Web site
Table convert tableconvert.com
Tables Generator tablesgenerator.com