Open edwindj opened 9 years ago
How do you want this to look? Do you want it to be like the handsontable implementation on paulfitz.github.io/daff? I think this would be a good start and happy to start putting together.
The other project I have been experimenting with heavily is https://github.com/benjamine/jsondiffpatch.
Seems fine to me to start with the implementation of daff (note that render_diff
does exactly that).
For a later version I may be nice to use bootstrap3 css style, so it integrates nicely with shiny/rmarkdown.
I was not familiar with this project (https://github.com/benjamine/jsondiffpatch), looks nice!
Aim of the projects is similar, but jsondiffpatch
more focused on non-tabular. What is nice about jsondiffpatch
is the built in html renderer, so making a htmlwidget is much easier.
Just wanted to circle back to this. There are lots of easy improvements without even a full htmlwidget
implementation. I think a full implementation would be nice, but for now I'll submit a pull with the simple change. Sorry it has taken me so long.
Here is the non-htmlwidget implementation https://github.com/timelyportfolio/daff/tree/feature/htmltools using just the helpful htmltools
from RStudio. The quick win here is now render_diff
will show up in rmarkdown
documents, which I demonstrated with this silly vignette.
Also, here is an example in Shiny.
library(shiny)
library(daff)
ui <- fluidPage( uiOutput("daff") )
server <- function(input,output,session){
output$daff <- renderUI({
y <- iris[1:3,]
x <- y
invalidateLater(1000, session)
x[,1] <- jitter(y[,1])
patch <- diff_data(y, x)
render_diff(patch, fragment = F)
})
}
shinyApp(ui,server)
I would enjoy your thoughts on this. Thanks.
Hi, is there any progress on this one? I think render_diff is pretty close to the htmlwidget convention, just last mile to wrap in the standard format
This is excellent work, thank you. Any progress on embedding render_diff
output within an rmarkdown document?
Here is my local hack to get daff chunks into rmarkdown HTML documents:
# temp hack to get daff chunks into an rmarkdown doc
wrapDaffHTML <- function(chunkHTML, chunkTitle) {
cat("<div class='highlighter' style='align:center; font-size:80%;'>")
cat(paste0("<h3>", chunkTitle, "</h3>"))
cat(chunkHTML)
cat("</div><br><br>")
}
I am sure there is a better way, but this seems to work OK. It would be nice to get the summary HTML chunks, but I can live without those for now.
Thx for your suggestions! I will work on rendering to markdown next week.
An
htmlwidgets
version of daff will allow fordata_diff
in shiny and rmarkdown.