Skip to content

Render r2d3 output in rmarkdown document with rmarkdown::knitr() function #102

@uriahf

Description

@uriahf

Hi everyone.

I want to create a parameterized document with r2d3 document.

Problem is that when I use the rmarkdown::knitr() function the output does not render well, while when I do the same while using the knitr button in the rstudio gui everything works well.

Here is the reprex:

Ymal

---
title: "d3_example"
output: html_document
date: "2023-09-19"
---

R code

library(r2d3)
bars <- c(10, 20, 30)

d3 code

svg.selectAll('rect')
  .data(data)
  .enter()
    .append('rect')
      .attr('width', function(d) { return d * 10; })
      .attr('height', '20px')
      .attr('y', function(d, i) { return i * 22; })
      .attr('fill', options.color);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions