Insert specific unicode symbols inside values of data.frame variable

Please see the policy on cross posts

xsubi <- "X\u1d62"
xsubi
#> [1] "X\u1d62"
cat(xsubi)
#> Xᵢ
xsubs <- "X\u209b"
xsubs
#> [1] "X\u209b"
cat(xsubs)
#> Xₛ

Created on 2019-11-29 by the reprex package (v0.3.0)

The differences are caused by which code points are supported by which encoding and whether the font has the code point. Glyphs for superscripts and subscripts are problematic, and no compelling reason comes to mind for preferring them over mark-up language representations.

The alternative is to enter the variables as \LaTeX markup

x <- data.frame("mu"    = "$\\mu$",
                "bsub2" = "$B_2$",
                "xsubi" = "$X_i$",
                "xsubs" = "$X_s$")
x
#>       mu bsub2 xsubi xsubs
#> 1 $\\mu$ $B_2$ $X_i$ $X_s$

Created on 2019-11-29 by the reprex package (v0.3.0)

To display, save an Rmd file with those contents and apply rmarkdown::render, as shown here. Not that I'd recommend putting mark-up language symbols as data frame entries.