na_string

0th

Percentile

NA string

Functions to get or set the na string property of huxtable table 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 for the default, which is the empty string. To get literal "NA", set to "NA". Set to NA to reset to the default.

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 attribute. For set_na_string, the ht object.

See Also

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

Aliases
  • na_string
  • na_string<-
  • set_na_string
  • na_string.huxtable
  • na_string<-.huxtable
Examples
# NOT RUN {
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)
# }
Documentation reproduced from package huxtable, version 1.2.0, License: MIT + file LICENSE

Community examples

Looks like there are no examples yet.