Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make output friendly to Quarto documents when there is any R code being executed in the .qmd file too #207

Open
srvanderplas opened this issue Jun 14, 2022 · 5 comments
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@srvanderplas
Copy link

It would be helpful to have a quarto-friendly output option, so that tables generated from skim render in markdown instead of rendering as code-like objects.

For instance, a file like this, with a python skim(df) statement and an R skim(df) statement

(you'll have to add the qmd extension, github won't let me upload a qmd file)
test.qmd

renders as

Screenshot of rendered html file showing skim-py output as text and skim-r output as HTML tables.

Thank you for making this package, btw - it has made it much easier to teach my students R and python simultaneously when there are so many packages that have parallel functions and syntax between them.

@aeturrell aeturrell self-assigned this Jun 22, 2022
@aeturrell aeturrell added the enhancement New feature or request label Jun 22, 2022
@aeturrell
Copy link
Owner

Hello,

Thanks for your positive feedback and clear suggestion! Do you know of any examples of how this is done with other Python packages? I'm trying to work out how to ensure that outputs rendered in quarto do this. BTW the skimpy website is generated via Quarto and the rendering seems to work there, so wondering if this could be more to do with Quarto settings than the Skimpy package? However, it would be great if it could 'just work'.

@srvanderplas
Copy link
Author

srvanderplas commented Jun 23, 2022 via email

@aeturrell
Copy link
Owner

Not made much progress on this yet, but confirmed that a Python quarto session works with the following

---
title: "Example Report"
author: "Joan Robinson"
format: html
toc: true
number-sections: true
jupyter: python3
---

## Test using skimpy in a Python session

```{python}
from skimpy import skim, generate_test_data

df = generate_test_data()
skim(df)
```

And that as soon as a single executable R chunk is added, the output switches to markdown. So the output would need to recognise that it's in a QMD file where R is also being run. Here's a reprex of where an R chunk being present causes the markdown output to occur from the Python chunk:

---
title: "Example Report"
author: "Joan Robinson"
format: html
---

## Test using skimpy in a Python session

Here is using skimpy

```{r}
data(mtcars)
```

```{python}
from skimpy import skim, generate_test_data

df = generate_test_data()
skim(df)
```

@GegznaV
Copy link

GegznaV commented Mar 3, 2023

Some users prefer markdown-like output (which can be rendered to usual tables) for others the "classical" output (as it is now) is preferred. So after the feature requested in this issue is implemented, please, leave an option (argument, etc.) to have the output in Quarto / R markdown / .ipynb / etc. documents as it is now (the "classical" output) too.

@aeturrell
Copy link
Owner

The ideal here would be to be able to recognise when a Quarto document has some R chunks and switch to the markdown output (instead of "classic") automatically in that situation. I think I'd need to talk to someone who has worked on Quarto to understand if this is possible and how to do it.

@aeturrell aeturrell added the help wanted Extra attention is needed label Sep 7, 2023
@aeturrell aeturrell changed the title Make output quarto-friendly Make output friendly to Quarto documents when there is any R code being executed in the .qmd file too Sep 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants