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

Scaffold support for R files #476

Closed
jaesmin opened this issue Jan 11, 2022 · 5 comments
Closed

Scaffold support for R files #476

jaesmin opened this issue Jan 11, 2022 · 5 comments

Comments

@jaesmin
Copy link

jaesmin commented Jan 11, 2022

Hello!
Running ploomber scaffold with a pipeline.yaml containing .R or .Rmd files returns this error, "This command does not support adding tasks with extension ".R", valid ones are .py and .sql."

Is scaffold able to create a pipeline with R files?

Thank you,
Jae

@edublancas
Copy link
Contributor

Hi @jaesmin!

Unfortunately, ploomber scaffold does not work with .R/.Rmd files yet, but thanks for reporting this, we'll add it to the roadmap for the next release 😊

In the meantime, you can use our R example to get started quickly: https://github.com/ploomber/projects/tree/master/templates/spec-api-r

If you have ploomber installed, you can get the example executing:

ploomber examples -n templates/spec-api-r -o r-example

Then move to the r-example folder and execute:

ploomber build

Note that for R to work with Ploomber, you need to install and configure IRKernel, check out the instructions here: https://docs.ploomber.io/en/latest/user-guide/r-support.html#configuring-r-environment

Let me know if you're able to run the R example, if you have further questions, you can join our Slack community: https://ploomber.io/community

Thanks for your feedback!

@edublancas
Copy link
Contributor

Hi, this has been fixed in Ploomber 0.14.5

Quick example:

# upgrade
pip install ploomber --upgrade

# get example
ploomber examples -n templates/spec-api-r -o example

# move to folder
cd example

Edit pipeline.yaml (e.g., here I add a new task at the end):

tasks:
  # use plain R scripts
  - source: raw.R
    product:
      # this is the executed version of your script
      # you can review tables and charts here
      nb: output/raw.html
      data: output/raw.csv

  - source: clean.R
    product:
      nb: output/clean.html
      data: output/clean.csv

  # R markdown files also supported
  - source: plot.Rmd
    product: output/plot.html

  # my new task
  - source: new-task.Rmd
    product: output/new-task.html

Then:

# add new task
ploomber scaffold

# build pipeline
ploomber build

If you're using RStudio, you can run the following to inject input paths on each file:

# inject cells
ploomber nb --inject

# now open any .Rmd files and execute them

More on that here: https://docs.ploomber.io/en/latest/user-guide/editors.html

Feel free to ask any questions and please submit any feedback you may have!

@edublancas
Copy link
Contributor

We just uploaded an R screencast :) https://www.youtube.com/watch?v=AOd7JHXpchc

@jaesmin
Copy link
Author

jaesmin commented Jan 24, 2022

Amazing. Thank you!

@edublancas
Copy link
Contributor

Forgot to post the blog post URL. Reach out if you have feedback questions :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants