# R Users & R Markdown

When posting R markdown (`.rmd`, or `.Rmd` files) to Kyso you will need to convert them to normal markdown (`.md`) files before they hit Kyso. That can be before you upload them, or before you commit them to your Github repository.&#x20;

When you convert Rmd to normal markdown it will create run the code in the Rmd file, generate any images and tables needed, create a markdown file and an assets folder for any image files. You can them upload the markdown and assts folder to Kyso.

## Converting R to other formats

### Installing knitr

Knitr is the package that we will use to convert the Rmd files to markdown in order to upload to Kyso, lets install it first using inside your R console:

```
install.packages("knitr")
```

### Using the command line

In the directory of your .Rmd file just use the following command:

```
Rscript -e "library(knitr); knit('notebook.Rmd', 'notebook.md')"
```

### Using R Studio

Make sure you set the working directory to the location of your .Rmd files.&#x20;

![R Studio Interface](/files/-Lq0LHyNzHA0ugLpx9zk)

Once you have your working directory set go to your R console inside R studio and enter the following commands, first to load knitr and then to convert the notebook:

```
library(knitr)
knit('notebook.Rmd', 'notebook.md')
```

![Compiling R markdown to markdown](/files/-Lq0LrqnRxGAwSclvRiQ)

{% hint style="info" %}
When publishing to Kyso, be sure to select the generated .md file as the main file, not the .Rmd
{% endhint %}

## Compiling R to HTML

Kyso now also supports HTML! This means R users are also able to compile their scripts to HTML. This will benefit those who like to work with interactive graphing libraries like plotly and bokeh.

Using the above example:

```
library(knitr)
knit('notebook.Rmd', 'notebook.html')
```

And then follow the link below to learn how to ensure a successful upload of HTML to Kyso:

{% content-ref url="/pages/qRkNxsUCIee3Clo06K1T" %}
[HTML](/kysos-renderer/html.md)
{% endcontent-ref %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.kyso.io/guides/posting-r-markdown-to-kyso.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
