This is the first time I tried reactable and raising questions in stack overflow. I apologise in advance if anything is unclear.
I was working on a simple reactable, and while the preview in RStudio looks fine, when I tried to save it as png and html, 5 paragraph break symbol (pilcrow) appears on the top of the output.
This is a screenshot of preview in R Studio:
Not sure if it's related, but I got the below warning during output as well:
[WARNING] Deprecated: --self-contained. use --embed-resources --standalone
I tried others' reactable, and it produced the same paragraph break symbol in the html and png output.
Below are the codes I used:
# Libraries
library(dplyr)
library(ggplot2)
library(tidyr)
library(reactable)
library(reactablefmtr)
library(utf8)
library(gt)
library(htmlwidgets)
library(webshot2)
webshot::install_phantomjs()
# data
Rank <- c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
Name <- c('Red Lion', 'Crown', 'Royal Oak', 'White Hart', 'Railway', 'Plough', 'Swan', 'White Horse', 'Kings Arm', 'Ship')
Number <- c(519, 485, 406, 300, 280, 278, 276, 271, 237, 230)
Popular_Pub_Name <- data.frame(Rank, Name, Number)
# reactable
table <- reactable(Popular_Pub_Name,
defaultSorted = "Number",
width = 500,
defaultColDef = colDef(align = "left"),
columns = list(
Rank = colDef(
width = 60
),
Name = colDef(
name = "Pub Name",
width = 100
),
Number = colDef(
defaultSortOrder = "desc",
width = 200,
cell = data_bars(Popular_Pub_Name,
fill_color="#7814ff",
text_position = "outside-end",
bar_height = 10,
text_size = 12,
min_value=0,
max_value =600,
background = "transparent"
)
)))
table1 <- table %>%
add_title("UK's Most Popular Pub Name"
)
# output
html <- "pub_name1.html"
saveWidget(table1, html)
# save as png
webshot(html, "pub_name1.png", zoom = 3, vwidth = 500)