View source: R/fct_expand_seq.R

fct_expand_seq | R Documentation |

Expands an ordered factor from one level to another

```
fct_expand_seq(
x,
min_lvl = min(x, na.rm = TRUE),
max_lvl = max(x, na.rm = TRUE),
by = 1L
)
```

`x` |
An ordered factor |

`min_lvl` |
The start of the level sequence |

`max_lvl` |
The end of the level sequence |

`by` |
Integer, number of steps in between |

Defaults for `min_lvl`

and `max_lvl`

are the minimum and maximum
levels in the ordered vector `x`

.

An `ordered`

vector

```
x <- ordered(letters[c(5:15, 2)], levels = letters)
fct_expand_seq(x)
fct_expand_seq(x, "g", "s", 3L) # from "g" to "s" by 3
fct_expand_seq(x, "g", "t", 3L) # same as above
# from the first inherit level to the last observed
fct_expand_seq(x, min(levels(x)))
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.