R: NA string

na_string {huxtable} | R Documentation

## NA string

### Description

Functions to get or set the na string property of huxtable cells.

### Usage

    na_string(ht)
    na_string(ht) <- value
    set_na_string(ht, row, col, value, byrow = FALSE)

### Arguments

`ht` | A huxtable.
`value` | A character string. This will be used to replace NA values in the display. Set to `NA` to reset to the default, which is `""`.
`row` | A row specifier. See `rowspecs` for details.
`col` | An optional column specifier.
`byrow` | If `TRUE`, fill in values by row rather than by column.

### Value

For `na_string`, the `na_string` property. For `set_na_string`, the `ht` object.

### See Also

Other formatting functions: `background_color`, `bold`, `font_size`, `font`, `number_format`, `text_color`

### Examples

    ht <- huxtable(a = 1:3, b = 1:3)
    na_string(ht) <-  '--'
    na_string(ht)
    ht[2,2] <- NA
    print_screen(ht)

    ht <- huxtable(a = 1:3, b = 3:1)
    ht2 <- set_na_string(ht, '--')
    na_string(ht2)
    ht3 <- set_na_string(ht, 1:2, 1, '--')
    na_string(ht3)
    ht4 <- set_na_string(ht, 1:2, 1:2, c('--', ''), byrow = TRUE)
    na_string(ht4)
    ht5 <- set_na_string(ht, where(ht == 1), '--')
    na_string(ht5)

[Package huxtable version 4.2.0 Index]