The added image is created from the following code:
B <- addmargins(table(data$range, data$symbols))
B[] <- sprintf('%s (%s)', as.matrix(B), paste0(round(prop.table(as.matrix(B), 1), 2) * 200, '%'))
knitr::kable(B)%>%
kable_styling(bootstrap_options= c("striped", "hover"), font_size=16, position="center")
```
The last column is called SUM, which you can see. I want to remove the %
sign from the last column.
To achieve this, I tried using gsub
like so
res <- gsub("%","", B[ , ncol(B[])])
knitr::kable(res)%>%
kable_styling(bootstrap_options= c("striped", "hover"), font_size=16, position="center")
```
It does remove the %
signs, but it also removes all the other columns, and only shows the last column. How can I make it keep the other columns?