0

How could I keep the 0? In a for loop, I have

# the_hux is some huxtable by as_hux_table()
the_hux[1, 2] <- i
print(i)
print(the_hux[1, 2])

and this is the output:

[1] "H01"
                                          H1         
                                  ───────────────────

Column names: stat_0

I tried the_hux[1, 2] <- as.character(i) and the same output showed. I wish to keep 0 in the cell.


Edit:

# library(gtsummary)
# library(huxtable)
df1 <- data.frame("a" = c(1:5), "b" = c(1:5))
df1 %>% 
  tbl_summary() %>%
  as_hux_table() -> df1_hux
df1_hux[1, 2] <- "A01"
print(df1_hux[1, 2])
# print(df1_hux)

Output in Console:

                                          A1         
                                  ───────────────────

Column names: stat_0
yyyyp
  • 1
  • 1

0 Answers0