5

I have a R notebook in Kaggle that I would like to convert to pdf or html. All the solutions I have found in the forums seem to be python oriented.

Is there any way to get that? Is there any third-party tool to convert it to the format of my choice?

4
  • 4
    It would help if you include an example, because without one this is basically a request for a tool or library, which is off-topic for SO Commented Dec 27, 2021 at 17:51
  • 1
    Why not simply download the notebook and knit? Commented Dec 28, 2021 at 11:44
  • did my answer work for you? If so, could you mark it as the answer? Commented Jan 4, 2022 at 3:45
  • @MartinC.Arnold Could you please explain a bit more? Commented Jan 4, 2022 at 17:40

1 Answer 1

2

Updated answer (I just realized you were looking for not just PDF, but PDF OR HTML):

You should be able to just click File>Save Version and have your notebook render, so I suspect that some of your settings are wrong if you're not able to do that.

  1. Go through this checklist to make sure it's setup correctly. In the editor, make sure your settings are as follows:
  • Editor menu bar>File>Editor Type: select Script
  • Editor menu bar>File>Language: select 'RMarkdown'
  1. Make sure your YAML includes the output format. It should look like below, with the critical line being output: html_notebook
---
title: "Untitled"
author: "Garrett"
date: "July 10, 2014"
output: html_notebook
---
  1. Click on the menu bar>File>Save Version. This will render your report and save the output.

  2. In the window that pops-up showing that your workbook has being created, click on the three dots and select 'Open in Viewer' when it says it was Successful in creating it.

  3. In the 'Report' view for this report, right-click on something from your report and select 'View Frame Source'. This will open up the HTML source code for your report. (I'm using Chrome on windows - not sure if other browsers have same options).

  4. With the source window open, remove view-source: from the start of the URL and you'll see just the HTML output of your notebook. Right click the page to print to PDF or save to HTML.

Note: There are some settings in the HTML/javascript that prevent scrolling of the window, but that's not an area I'm familiar with so can't help with that

Sign up to request clarification or add additional context in comments.

5 Comments

Thanks for the detailed answer but I dont see any YAML configuration (2). I dont see the 'report' view either (5). I used cntrl+F in both cases
@Alfonso_MA are you using the R markdown notebook or the jupyter notebook?
Are not they the same thing? I just clicked "+ New Notebook" button from "Code" menu. Then File->Language->R
check the settings that I described in the answer
Thanks for the effort with this. I see now. I am using jupyter notebook, not RMarkdown. Jupyter notebook is what I need and what my question is about. I am able to visualize the HTML output of my notebook like your step 6, but I can not scroll there and when I save it several .js .css files are created. Not a single html file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.