I have a shiny app which I have published on shinyapps.io.
I am trying to save(download) html files that I create using rmarkdown to a local drive. I can download pdf, jpeg or png formats. but the reason to save html version is to keep the interactive plots that I have created using plotly and ggplot where I can hover my mouse over data and see values.
After a lot of research, I found out a way to save (upload) the html files to my own dropbox using drop_upload function. But it's very inconvenient and not accessible to anyone except me.
So I was wondering if someone could help me with a way to save/download rmarkdown html files to a local drive from shinyapps.io?
Related
This is quite similar to what is being asked in this post, but the post does not seem to work for GitHub's parsed Markdown.
Simply put, let us say I have a PDF in a GitHub repository. Is there any way to render/embed that in a markdown file that is in the repository (e.g. the README.md file)?
I would also be open to having the PDF in a location other than GitHub and linking to it from the markdown file if that is what is required to make this work.
Currently there is no way to preview a pdf in github markdown, however you can embed an image of the pdf.
Edit
From here:
The best you can do is a greasemonkey extension which would allow you to call a pdf viewer, like the recent pdf.js (a Portable Document Format (PDF) viewer that is built with HTML5.), allowing you to view a pdf entirely online, without any pdf plugin installed.
As far as I know, this is not possible on GitHub.
However, you can upload it as a file in the same repository and then add a link to it with a relative path.
[Some title here](FILE_NAME.pdf)
I need to preview files of the format pdf or doc. I looked for solutions which included using with the googledocsviewer but the file that I want to preview is present right in the application as a File object. Itried using the with the fileReader.readasDataUrl function and was able to preview txt and image format files, but I need to work with the other formats too.I came across a npm package called file preview https://www.npmjs.com/package/filepreview but I could not understand how to use it. Any suggestions are appreciated.
I'm preparing a presentation in .Rmd (R markdown) file using slidify.
I have some vector graphics saved as PDF files that I would like to render on particular slides.
I've tried methods that I used in raw .Rmd (markdown syntax) as well as those from bookdown. However, none of them works.
As I can see in generated HTML, PDF file location is directly provided in img src and as I understand HTML files do not directly support PDF files.
However, I'm not sure what to do (what is the best approach):
convert PDF (to .svg) and use it in .Rmd?
try to write some raw HTML in my .Rmd fo;e using suggestion from Recommended way to embed PDF in HTML? that will allow me to render PDF,
use different command to embed PDF in presentation (something specific to slidify)?
I have just created a simple interactive map using leaflet package in R. Something like this
leaflet() %>% addTiles()
Now I would like to embed it in my wordpress website.
I clicked on the export button of RStudio Viewer and chosen "Save as web page...", then stored the .html in my local computer.
I tried to embed this map in a post in my WP website by clicking on "Add a media" in the editor of the page and the choosing the .html previously stored. But I get the error:
"1 file could not be uploaded because the file type is not supported."
I tried to open the html file in an editor and copy and paste the (very long, full of coordinates) html code into the html tab of WP page editor. The editor convert this code into
<div id="htmlwidget_container">
<div id="htmlwidget-2390" class="leaflet html-widget" style="width: 100%; height: 400px;"></div> </div>
and I don't see any map in the visual tab.
I really don't know how to proceed. Any help will be appreciated. As you have noticed I am completely new to WP and web applications.
Thanks a lot,
jacopo
U can try to save the widget to a .html file and import this .html file to your media library.
library(htmlwidgets)
library(DT)
a <- datatable(iris)
saveWidget(a, "datatable-iris-example.html")
Next, import the .html file to your media library. Then, add the shortcode to your post. Here's how to encode it in the page when editing the blog post:
<iframe seamless src="http://www.phillipburger.net/wordpress/wp-
content/uploads/2015/05/datatable-iris-example.html" width="100%"
height="500"></iframe>
All credits go to Phillip Burger and his post.
Anyone got a better method?
I have not qa tested this but... my logic is use the raw HTML widget and add a simple php include line. kinda like this
<h3>My aweseome R map</h3>
<?php include 'saved_file.html';?>
The concept comes from Static Content CMS concepts where you import so to speak existing pieces.
Steps:
1) Install the plugin which allows embedding extra File Extensions, and check .html in that plugin's options page.
2) now try to upload .html file in WP.
3) embed the uploaded file as <iframe> element, or use plugins like : include-me or include-url or simple-include
I know this post is old but I just cobbled together a way to do this and wanted to share.
I knew I could save my plot as an html file using the same method #OBB3 described above, and I knew that I wanted to embed it on my website using <iframe>, but I could not figure out how to actually host the file on the internet to then point my <iframe> to.
I ended up finding a GitHub solution, which has the added benefit that I can easily change my plot, push those changes, and the plot will be automatically updated on my website:
Create a new repo
Add the .html file of your plot to the repo
Go to Settings > Pages, and under "Source" choose the "main" branch.
Point your iframe to http://username.github.io/repository/myplot (filling in the bold sections with your GitHub username, the name of the repo, and pre-extension name of your .html file, respectively)
Credit goes to Elizabeth Ter Sahakyan's post for teaching me most of the above.
All the interactivity and different elements of my plot have been preserved using this method.
In matplotlib, I am capturing the pictures of figure in .png format using savefig() method. Say I have 4 pictures. Like how we convert .png files and create a pdf pages, I need to convert and save them into .pptx and .html webpages.
FYI Regarding pdf conversion we already have "from matplotlib.backends.backend_pdf import PdfPages"
Please share your suggestions.
Thanks in advance.
If you want to write your own batch import routine, you can use VBA in PowerPoint. This page on my PPT FAQ site will get you started:
BATCH IMPORT images into PowerPoint
http://www.pptfaq.com/FAQ00050_BATCH_IMPORT_images_into_PowerPoint.htm
You can also use PowerPoint's Picture Album feature to do more or less the same thing.