Questions tagged [htmltools]

htmltools is an R package that contains tools for generating HTML output directly from R.

htmltools provides R users with a means to generate HTML output such as tags and styles directly from R. It provides additional development tools such as dependency identification and tag attribute management. htmltools provides much of the underlying HTML functionality for other common packages like Shiny and rmarkdown.

This tag should be used in questions that directly reference the htmltools package and could also be useful for questions related to other packages (like Shiny and rmarkdown) when the post involves functionality imported into that package from htmltools.

72 questions
11
votes
4 answers

How to store r ggplot graph as html code snippet

I am creating an html document by creating various objects with ggplotly() and htmltools functions like h3() and html(). Then I submit them as a list to htmltools::save_html() to create an html file. I would like to add ggplot charts directly as…
user3799203
  • 444
  • 1
  • 4
  • 15
10
votes
2 answers

R: How to elegantly separate code logic from UI / html-tags?

Problem When dynamically creating ui-elements (shiny.tag, shiny.tag.list, ...), I often find it difficult to separate it from my code logic and usually end up with a convoluted mess of nested tags$div(...), mixed with loops and conditional…
Comfort Eagle
  • 2,112
  • 2
  • 22
  • 44
9
votes
3 answers

Text to be written must be a length-one character vector

After installing the new version of shiny (1.4.0) package, I face a strange error message > Warning: Error in writeImpl: Text to be written must be a length-one > character vector [No stack trace available] I do not really understand what has…
And_R
  • 1,647
  • 3
  • 18
  • 32
8
votes
1 answer

Clicking a leaflet marker takes you to URL

Within the leaflet package for R, is there a way to click on a marker, and be directed to a URL?* Here's the JS solution. In R, to add a Popup with a URL: library(leaflet) content <- paste(sep = "
", "
Rich Pauloo
  • 7,734
  • 4
  • 37
  • 69
7
votes
1 answer

DT Shiny different custom column header by column

my css skills are extremely limited but assuming the following example: sketch = htmltools::withTags(table( class = 'display', thead( tr( th(rowspan = 2, 'Species'), th(colspan = 2, 'Sepal'), …
J. Doe.
  • 1,255
  • 1
  • 12
  • 25
6
votes
2 answers

How to add title to a networkD3 visualisation when saving as a web page?

I have created a interactive visualisation using the following code: library(networkD3) nodes = data.frame("name" = c("node1", "node2","node3", "node4", "node5", "node6", "node7")) links =…
Callum Smyth
  • 127
  • 2
  • 7
3
votes
0 answers

change size of plots in htmltools::taglist R markdown

I am trying to use a loop in Rmarkdown that prints a leaflet map and plotly graph side by side (the loop iterates through vegetation types). I am having trouble getting the side-by-side to have the height and width I desire. In the joint plot I…
kingmidaz
  • 53
  • 6
3
votes
1 answer

Shiny app as function, where to put www/ folder, CSS, JS

I am attempting to convert a relatively complex shiny app (3-4 modules, 8 CSS/JS files) into a package with one external function that builds an instance of an app for a given input (build_myApp(dataset1, title, factors) which is stored in…
jatkins23
  • 31
  • 2
3
votes
1 answer

Encode character to HTML in R, the CRAN way

Before voting for close as duplicate please ensure that it does actually answer my particular question here. Questions may look similar, but I haven't found an answer for mine. Thank you. I am looking for a way to convert arbitrary scalar character…
jangorecki
  • 16,384
  • 4
  • 79
  • 160
3
votes
1 answer

Set title of leaflet for R web page

I am using the R leaflet package to generate a map. When the web page is created, the element of the web page is set to "leaflet": <title>leaflet I would like to change this to something more informative, but I cannot see a way to…
user3004015
  • 617
  • 1
  • 7
  • 14
3
votes
1 answer

Including external markdown file covering inline code through includeMarkdown

I would like to include external markdown file covering inline code as well. Once I hit the Knit on RStudio, it does show only code text rather than the actual value of sys.time. If I place the content of about.md into the main.Rmd, there is no…
ozturkib
  • 1,493
  • 16
  • 28
3
votes
1 answer

Add or update attribute to an element and all sub-elements

I'm working on a full page layout using fillPage(). For a box to be able to stretch vertically, all elements that define this box need to have a style = "height: 100%" attribute (or so I'm told). Is there a way to append/update the style attribute…
krlmlr
  • 25,056
  • 14
  • 120
  • 217
3
votes
0 answers

Add new line spaces between elements of an htmltools::tagList in an Rmarkdown html page

I using htmltools::tagList to display a list of plots in an Rmarkdown html page. Let's say my list of plots is: set.seed(1) plot.list <- lapply(1:3, function(i) plotly::plot_ly(x=paste0(c("a", "b", "c"), ":", i), …
dan
  • 6,048
  • 10
  • 57
  • 125
3
votes
1 answer

R Leaflet plot ship direction

I have information on the location of vessels/ships and the course they are steering. I'd like to plot them on a leaflet map with a custom icon which looks like a ship. I found the "tags" icon from glyphicons to be most suitable. Here's some data to…
Dhiraj
  • 1,650
  • 1
  • 18
  • 44
3
votes
1 answer

R: add title to networkD3 plot and save

I am interested in adding a title to a forceNetwork graph created with NetworkD3 and exporting the html with magrittr. A solution was found in the R: HTML Tag Object help page in order to add a title. Then I was directed to adding htmltool…
adm
  • 354
  • 5
  • 17
1
2 3 4 5