R: Return every n row or column numbers

every {huxtable} | R Documentation

## Return every n row or column numbers

### Description

This is a convenience function to use in row or column specifications. In this context, `every(n, from)` will return `from, from + n, ...,` up to the number of rows or columns of the huxtable. `evens` and `odds` return even and odd numbers, i.e. they are equivalent to `every(2, 2)` and `every(2, 1)` respectively. `everywhere` returns all rows or columns, equivalently to `every(1)`.

### Usage

    every(n = 1, from = n)

    everywhere(ht, dimension)

    evens(ht, dimension)

    odds(ht, dimension)

### Arguments

`n` | A number (at least 1)
`from` | A number (at least 1)
`ht` | An object with a `dim` attribute like a matrix or data frame.
`dimension` | Number of the dimension to use.

### Details

Technically, `every` returns a 2-argument function which can be called like `f(ht, dimension)`. See rowspecs for details.

### Examples

    ht <- huxtable(a = 1:10, b = 1:10)
    ht <- set_background_color(ht, every(3), everywhere, 'wheat')
    background_color(ht)
    ht <- set_align(ht, evens, 1:2, 'right')
    ht <- set_align(ht, odds, 1:2, 'center')
    align(ht)

[Package huxtable version 4.2.0 Index]