An open API service indexing awesome lists of open source software.

https://github.com/gadenbuie/lorem

Generate Lorem Ipsum Text
https://github.com/gadenbuie/lorem

lorem-ipsum lorem-ipsum-generator r-pkg rstats rstudio rstudio-addin

Last synced: over 1 year ago
JSON representation

Generate Lorem Ipsum Text

Awesome Lists containing this project

README

          

---
output: github_document
---

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
set.seed(424342)
```

# lorem::ipsum()

[![CRAN status](https://www.r-pkg.org/badges/version/lorem)](https://CRAN.R-project.org/package=lorem)
[![lorem r-universe badge](https://gadenbuie.r-universe.dev/badges/lorem)](https://gadenbuie.r-universe.dev/lorem)
[![R-CMD-check](https://github.com/gadenbuie/lorem/actions/workflows/check-standard.yaml/badge.svg)](https://github.com/gadenbuie/lorem/actions/workflows/check-standard.yaml)

* Quickly generate lorem ipsum placeholder text with `lorem::ipsum()`.

* Easy to integrate in RMarkdown documents.

* Includes an RStudio addin to insert *lorem ipsum* into the current document.

## Installation

You can install the latest released version of lorem from CRAN

``` r
install.packages("lorem")
```

or the current development version of lorem from GitHub or r-universe

``` r
# GitHub
# install.packages("remotes")
rmeotes::install_github("gadenbuie/lorem")

# R Universe
install.packages('lorem', repos = c('https://gadenbuie.r-universe.dev', 'https://cloud.r-project.org'))
```

## Usage

### RStudio Addin

**lorem** includes a simple addin for RStudio that
adds placeholder _lorem ipsum_ text to the current source document.
The addin allows you to specify the number of desired paragraphs and sentences.

### R Markdown

Another way to generate _lorem ipsum_ placeholder text is to call
`lorem::ipsum()` in an inline R chunk in R Markdown.

```markdown
`r knitr::inline_expr("lorem::ipsum(paragraphs = 2)")`
```

`r paste(">", lorem::ipsum(2), collapse = "\n>\n")`

You can control the number of `paragraphs` and `sentences` per paragraph.

```markdown
`r knitr::inline_expr("lorem::ipsum(paragraphs = 3, sentences = c(1, 2, 3))")`
```

`r paste(">", lorem::ipsum(3, 1:3), collapse = "\n>\n")`

You can also adjust the `avg_words_per_sentence` to create long or short paragraphs.

```markdown
`r knitr::inline_expr("lorem::ipsum(2, avg_words_per_sentence = 3)")`
```

`r paste(">", lorem::ipsum(paragraphs = 2, avg_words_per_sentence = 3), collapse = "\n>\n")`

```markdown
`r knitr::inline_expr("lorem::ipsum(1, avg_words_per_sentence = 20)")`
```

`r paste(">", lorem::ipsum(1, 2, avg_words_per_sentence = 20), collapse = "\n>\n")`

### Everywhere Else

Generate _lorem ipsum_ anywhere else using `lorem::ipsum()` or `lorem::ipsum_words()`.

```{r results='asis'}
ipsum_items <- replicate(5, lorem::ipsum_words(5))
cat(paste("-", ipsum_items), sep = "\n")
```

## Ipsum gratiam

Thank you to
[Luke Haas](https://getlorem.com)
for the node module
[getlorem](https://github.com/lukehaas/getlorem)
and for providing the lorem ipsum word list used in this package.