{"id":15555388,"url":"https://github.com/sckott/scientist","last_synced_at":"2026-02-25T17:04:41.042Z","repository":{"id":140973728,"uuid":"188491125","full_name":"sckott/scientist","owner":"sckott","description":"Experiment with changes R code, scripts or packages","archived":false,"fork":false,"pushed_at":"2020-09-18T01:13:07.000Z","size":479,"stargazers_count":2,"open_issues_count":12,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-11T11:32:44.930Z","etag":null,"topics":["r","reproducibility","ropensci","rstats","workflow"],"latest_commit_sha":null,"homepage":"https://sckott.github.io/scientist","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/sckott.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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,"zenodo":null}},"created_at":"2019-05-24T21:45:40.000Z","updated_at":"2024-03-24T15:35:59.000Z","dependencies_parsed_at":"2023-06-29T06:00:21.622Z","dependency_job_id":null,"html_url":"https://github.com/sckott/scientist","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sckott/scientist","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sckott%2Fscientist","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sckott%2Fscientist/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sckott%2Fscientist/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sckott%2Fscientist/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sckott","download_url":"https://codeload.github.com/sckott/scientist/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sckott%2Fscientist/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29831853,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-25T15:41:19.027Z","status":"ssl_error","status_checked_at":"2026-02-25T15:40:47.150Z","response_time":61,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["r","reproducibility","ropensci","rstats","workflow"],"created_at":"2024-10-02T15:09:05.328Z","updated_at":"2026-02-25T17:04:41.004Z","avatar_url":"https://github.com/sckott.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"scientist\n=========\n\n```{r echo=FALSE}\nknitr::opts_chunk$set(\n  comment = \"#\u003e\",\n  collapse = TRUE,\n  warning = FALSE,\n  message = FALSE\n)\n```\n\n[![Project Status: Concept – Minimal or no implementation has been done yet, or the repository is only intended to be a limited example, demo, or proof-of-concept.](https://www.repostatus.org/badges/latest/concept.svg)](https://www.repostatus.org/#concept)\n\n__Experiment with changes in an R project__\n\nInspired by the Ruby gem [scientist](https://github.com/github/scientist) -\nbut instead of targeted at web apps, this project targets researchers/etc.\nthat want to compare changes in their code in a rigorous fashion.\n\n## How is this different from X tool?\n\n* git/version control: scientist does not play any part in managing or\ndealing versions of your project. use git for that.\n* unit tests: tests are meant for making sure changes you make to your code\ndon't change outputs. scientist is a sort of opposite to\nunit tests in that it aims to tell you **how** changes in your code\n**do change** the outputs.\n* benchmarking/profiling: scientist isn't purely a tool for comparing how\nfast your code runs, but it does include comparison of run times\nas a tool for decision making about what version to use\n\n \n## Use cases (click to expand)\n\n\u003cdetails\u003e \u003csummary\u003e\u003cstrong\u003eCode block\u003c/strong\u003e\u003c/summary\u003e \u003cp\u003e\n\nYou have some code. You want to make a change to the code,\nand you have a few different ideas about what you'd like\nto do. For example, you want to pre-allocate the size of the\ndata.frame to see if that saves time.\n\n`scientist` can help you sort out changes by comparing how long\neach version takes, and visually diff results.\n\nUsing `scientist` you can compare these two functions like:\n\n```{r eval=FALSE}\na \u003c- Experiment$new(name = \"compare_code\")\na$control(v1 = {\n  out \u003c- data.frame(letter = NA_character_, LETTER = NA_character_,\n    both = NA_character_, stringsAsFactors = FALSE)\n  for (i in 1:26)\n    out[i,] \u003c- c(letters[i], LETTERS[i], paste0(letters[i], LETTERS[i]))\n  out\n})\na$candidate(v2 = {\n  out \u003c- data.frame(letter = rep(NA_character_, times = 26),\n    LETTER = rep(NA_character_, times = 26),\n    both = rep(NA_character_, times = 26),\n    stringsAsFactors = FALSE)\n  for (i in 1:26)\n    out[i,] \u003c- c(letters[i], LETTERS[i], paste0(sample(letters, 1), LETTERS[i]))\n  out\n})\na\n```\n\nThen we can run the \"experiment\"\n\n```{r eval=FALSE}\na$run()\n```\n\nThen compare results\n\n```{r eval=FALSE}\na$diff()\n```\n\n![diff_plot](tools/code_block_diff.png)\n\n\u003c/p\u003e\u003c/details\u003e\n\n\u003cdetails\u003e \u003csummary\u003e\u003cstrong\u003eScripts\u003c/strong\u003e\u003c/summary\u003e \u003cp\u003e\n\nYou have an R script, let's call it `code.R`. Just as above with the code\nexample, you want to make a change to the script. Instead of using\ncode blocks as input as above, you can use file names. (NOTE: file names\nnot supported yet, see [issue #7](https://github.com/sckott/scientist/issues/7))\n\nUsing `scientist` you can compare these two scripts with:\n\n```{r eval=FALSE}\nb \u003c- Experiment$new(name = \"compare_scripts\")\nb$control(file = \"code.R\")\nb$candidate(file = \"code_new.R\")\n```\n\n\u003e note: above code doesn't work yet\n\n\u003c/p\u003e\u003c/details\u003e\n\n\u003cdetails\u003e \u003csummary\u003e\u003cstrong\u003ePackages\u003c/strong\u003e\u003c/summary\u003e \u003cp\u003e\n\nYou have a package, let's call it `foobar`. You want to change a function\nin `foobar` called `stuff()`. You make a new version of that function\ncalled `stuff_new()`. (NOTE: functions not supported yet per se, see \n[issue #8](https://github.com/sckott/scientist/issues/8); although\nyou can call functions just like code blocks)\n\nUsing `scientist` you can compare these two functions with:\n\n```{r eval=FALSE}\nres \u003c- Experiment$new(name = \"compare_stuff\")\nres$control(foobar::stuff(x = 5))\nres$candidate(foobar::stuff_new(x = 5))\n```\n\n\u003e note: above is pseudocode, as foobar is not a real package; though\n\u003e you can try functions from a real package\n\n\u003c/p\u003e\u003c/details\u003e\n\n\n\n## Install\n\n```{r eval=FALSE}\nremotes::install_github(\"sckott/scientist\")\n```\n\n```{r}\nlibrary(scientist)\n```\n\n## Usage\n\nInitialize an experiment\n\n```{r}\nres \u003c- Experiment$new(name = \"jane\")\n```\n\nSet your control code block\n\n```{r}\nres$control({\n  x = 5\n  x^2\n})\n```\n\nSet your candidate code block. You can have 1 or more candidates, which are\ncompared against the control.\n\n```{r}\nres$candidate({\n  y = 5\n  y^3\n})\n```\n\nNow you can see some control and candidate details\n\n```{r}\nres\n```\n\nRun the experiment\n\n```{r}\nres$run()\n```\n\nGet the results\n\n```{r}\nres$control_result\nres$candidate_results\n```\n\nGet all results plus timing data\n\n```{r}\nres$result()\n```\n\nPublish results - opens a page in your default browser\n\n```{r eval=FALSE}\nres$publish()\n```\n\n![img](tools/publish_eg.png)\n\n## Meta\n\n* Please [report any issues or bugs](https://github.com/sckott/scientist/issues)\n* License: MIT\n* Get citation information for `scientist` in R doing `citation(package = 'scientist')`\n* Please note that this project is released with a [Contributor Code of Conduct][coc]. By participating in this project you agree to abide by its terms.\n\n\n[coc]: https://github.com/sckott/scientist/blob/master/CODE_OF_CONDUCT.md\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsckott%2Fscientist","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsckott%2Fscientist","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsckott%2Fscientist/lists"}