Open happyshows opened 8 years ago
For this to work, we'll need to explictly convert using as.htmlwidget
first.
df <- data.frame(
id = 1:10,
name = c("Bob", "Ashley", "James", "David", "Jenny",
"Hans", "Leo", "John", "Emily", "Lee"),
age = c(28, 27, 30, 28, 29, 29, 27, 27, 31, 30),
grade = c("C", "A", "A", "C", "B", "B", "B", "A", "C", "C"),
test1_score = c(8.9, 9.5, 9.6, 8.9, 9.1, 9.3, 9.3, 9.9, 8.5, 8.6),
test2_score = c(9.1, 9.1, 9.2, 9.1, 8.9, 8.5, 9.2, 9.3, 9.1, 8.8),
final_score = c(9, 9.3, 9.4, 9, 9, 8.9, 9.25, 9.6, 8.8, 8.7),
registered = c(TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE),
stringsAsFactors = FALSE)
test <- formattable(df, list(
age = color_tile("white", "orange"),
grade = formatter("span",
style = x ~ ifelse(x == "A", style(color = "green", font.weight = "bold"), NA)),
test1_score = color_bar("pink", 0.2),
test2_score = color_bar("pink", 0.2),
final_score = formatter("span",
style = x ~ style(color = ifelse(rank(-x) <= 3, "green", "gray")),
x ~ sprintf("%.2f (rank: %02d)", x, rank(-x))),
registered = formatter("span",
style = x ~ style(color = ifelse(x, "green", "red")),
x ~ icontext(ifelse(x, "ok", "remove"), ifelse(x, "Yes", "No")))
))
htmlwidgets::saveWidget(as.htmlwidget(test),'test.html')
@timelyportfolio do you know what's this warning about?
pandoc.exe: Could not determine mime type for
test_files/bootstrap-3.3.5/css../fonts/glyphicons-halflings-regular.woff2'
Error: pandoc document conversion failed with error 1
In addition: Warning message:
running command '"C:/Program Files/RStudio/bin/pandoc/pandoc" F:\Stash\Apps\WSP\test.html --from markdown_strict --output F:\Stash\Apps\WSP\test.html --self-contained --template C:\Users\xle\AppData\Local\Temp\RtmpSUWrjr\filebb8267d55b1.html' had status 1 `
pandoc doesn't like woff2
. I thought we had fixed this. Let me look and fix.
I believe this should now be fixed with 9637a33c113070c1329a24ea2a35908882fb6f2b. Could you try it out?
I reinstalled using devtools::install_github("renkun-ken/formattable") is this the right way to patch a commit?
I'm still seeing the same error.
Downloading github repo renkun-ken/formattable@master
Installing formattable
"C:/Rhome/bin/x64/R" --vanilla CMD INSTALL \
"C:/Users/xle/AppData/Local/Temp/RtmpcZeXor/devtools23644d816028/renkun-ken-formattable-9637a33" \
--library="F:/RLib" --install-tests
I think the commit is incorporated
What you did sounds right. Let me dig a little deeper. Are you getting this with saveWidget
or with rmarkdown
?
saveWidget, I was trying to use this in shiny to create a downloadable html for formattable. But I got the error even without using shiny.
is there a directory like test_files
that still exists? I wonder if there is something stuck in cache.
I removed test_files and restarted R session, still the same :(
update: I have upgraded htmlwidgets to 0.5.2 and it's running without error now. However, it's running forever. But the generated test.html looks fine.
ok, great. I'm not sure what takes it so long. I am guessing all the bootstrap files. Glad it worked. That was going to be my next suggestion :)
Is there anyway to skip the generation of test_files?
not that I am aware of, but they should only be temporary and disappear after save. Is this not the way it works on your machine?
since it's running forever I had to kill the process which might skip the folder deletion code...
I hit this issue as well trying to save a leaflet map... Anyone figure out a work around?