{"id":20448572,"url":"https://github.com/datacamp/tutorial","last_synced_at":"2025-07-28T23:05:01.237Z","repository":{"id":147371604,"uuid":"50376571","full_name":"datacamp/tutorial","owner":"datacamp","description":"R Package to convert R Markdown files to DataCamp Light HTML files","archived":false,"fork":false,"pushed_at":"2022-11-02T15:13:23.000Z","size":883,"stargazers_count":87,"open_issues_count":8,"forks_count":31,"subscribers_count":25,"default_branch":"master","last_synced_at":"2025-04-13T01:29:16.989Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/datacamp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-01-25T19:52:10.000Z","updated_at":"2025-02-07T14:55:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"a0f4c307-a37a-4615-a2f7-5761090dc816","html_url":"https://github.com/datacamp/tutorial","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/datacamp/tutorial","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datacamp%2Ftutorial","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datacamp%2Ftutorial/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datacamp%2Ftutorial/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datacamp%2Ftutorial/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/datacamp","download_url":"https://codeload.github.com/datacamp/tutorial/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datacamp%2Ftutorial/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267600091,"owners_count":24113713,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-28T02:00:09.689Z","response_time":68,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-15T10:35:47.683Z","updated_at":"2025-07-28T23:05:01.232Z","avatar_url":"https://github.com/datacamp.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tutorial\n\n`knitr` utility to convert your static code chunks into an R editor where people can experiment. Powered by [DataCamp Light](https://www.github.com/datacamp/datacamp-light), a lightweight version of DataCamp's learning interface.\n\n## Installing the package\n\nLatest released version from CRAN\n\n```R\ninstall.packages(\"tutorial\")\n```\n\nLatest development version from GitHub:\n\n```R\nif(!require(devtools)) {\n  install.packages(\"devtools\")\n}\ndevtools::install_github(\"datacamp/tutorial\")\n```\n\n## Getting started\n\nAdd the following chunk at the top of your R Markdown document\n\n    ```{r, include=FALSE}\n    tutorial::go_interactive()\n    ```\n\nKnit your document: in RStudio, simply hit \"Knit HTML\", or use\n\n```R\nrmarkdown::render(\"path_to_my_file\", output_format = \"html_document\")\n```\n\n## How it works\n\nR vignettes, blog posts and teaching material are typically standard web pages generated with R markdown. DataCamp has developed a framework to make this static content interactive: R code chunks are converted into an R-session backed editor so readers can experiment.\n\n### Fiddles\n\nIf you render an R Markdown document like this:   \n\n    ---\n    title: \"Example Document\"\n    author: \"Your name here\"\n    output:\n      html_document:\n        self_contained: false\n    ---\n\n    ```{r, include=FALSE}\n    tutorial::go_interactive()\n    ```\n    \n    By default, `tutorial` will convert all R chunks.\n\n    ```{r}\n    a \u003c- 2\n    b \u003c- 3\n\n    a + b\n    ```\n\nAn HTML file results that features an in-browser R editor with a session attached to it, where you can experiment.\n\n![html_file](https://s3.amazonaws.com/assets.datacamp.com/img/github/content-engineering-repos/tutorial_fiddle2.png)\n\nNotice that the option `self_contained: false` is used. That way, always the latest version of the DataCamp Light JS library is fetched when the document is opened. If `self_contained: true`, the version of the JS library at 'knit time' is baked into the HTML document. This can cause backwards compatibility issues.\n\n### Coding challenges\n\nYou can also embed coding challenges into your webpages. This group of code chunks:\n\n    ```{r ex=\"create_a\", type=\"pre-exercise-code\"}\n    b \u003c- 5\n    ```\n    \n    ```{r ex=\"create_a\", type=\"sample-code\"}\n    # Create a variable a, equal to 5\n    \n    \n    # Print out a\n    \n    ```\n    \n    ```{r ex=\"create_a\", type=\"solution\"}\n    # Create a variable a, equal to 5\n    a \u003c- 5\n    \n    # Print out a\n    a\n    ```\n    \n    ```{r ex=\"create_a\", type=\"sct\"}\n    test_object(\"a\")\n    test_output_contains(\"a\", incorrect_msg = \"Make sure to print `a`.\")\n    success_msg(\"Great!\")\n    ```\n    \nConverts to the following DataCamp Light exercise:\n\n![html_file](https://s3.amazonaws.com/assets.datacamp.com/img/github/content-engineering-repos/tutorial_exercise.png)\n\n### Vignettes\n\nYou can power your package's vignettes with DataCamp Light by adding the same line to the top of your vignette:\n\n    ---\n    title: \"Tutorial Basics\"\n    author: \"Filip Schouwenaars\"\n    date: \"`r Sys.Date()`\"\n    output: rmarkdown::html_vignette\n    vignette: \u003e\n      %\\VignetteIndexEntry{Tutorial Basics}\n      %\\VignetteEngine{knitr::rmarkdown}\n      %\\VignetteEncoding{UTF-8}\n    ---\n\n    ```{r, include=FALSE}\n    tutorial::go_interactive()\n    ```\n    \n    _remainder of vignette omitted_\n\n## Python\n\nYou can also code up Python exercises with `tutorial`:\n\n    ---\n    title: \"Example Document\"\n    author: \"Your name here\"\n    output:\n      html_document:\n        self_contained: false\n    ---\n\n    ```{r, include=FALSE}\n    tutorial::go_interactive()\n    ```\n    \n    Here's an example of a Python fiddle/\n\n    ```{python}\n    a = 2\n    b = 3\n\n    print(a + b)\n    ```\n\n## Other Documentation\n\n- [Tutorial Basics Vignette](https://cran.r-project.org/package=tutorial): explanation on how to convert your static R code chunks into interactive fiddles or exercises, where you can also experiment with DataCamp Light itself.\n- [R Markdown](http://rmarkdown.rstudio.com/) and [knitr](http://yihui.name/knitr/) for dynamic documents with R.\n- [DataCamp Light JS library](https://www.github.com/datacamp/datacamp-light)\n- [Course creation for DataCamp](https://www.datacamp.com/teach/documentation). The documentation includes information on how to get started with course creation, what the different components of an exercise are, how you can write Submission Correctness Tests (SCTs) etc.\n\nFor more details, questions and suggestions, you can contact \u003cb\u003econtent-engineering@datacamp.com\u003c/b\u003e.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatacamp%2Ftutorial","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdatacamp%2Ftutorial","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatacamp%2Ftutorial/lists"}