{"id":17795220,"url":"https://github.com/matt-dray/choosethis","last_synced_at":"2025-04-02T02:27:51.217Z","repository":{"id":195042330,"uuid":"691953009","full_name":"matt-dray/choosethis","owner":"matt-dray","description":":computer_mouse::crossed_swords: R package: off-label concepts for executing R code from links in the console, using {cli}","archived":false,"fork":false,"pushed_at":"2023-09-17T11:37:05.000Z","size":49,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-27T04:38:16.774Z","etag":null,"topics":["cli","r-package","r-stats"],"latest_commit_sha":null,"homepage":"https://www.rostrum.blog/posts/2023-09-17-choosethis/","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/matt-dray.png","metadata":{"files":{"readme":"README.Rmd","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}},"created_at":"2023-09-15T08:37:40.000Z","updated_at":"2023-10-19T13:03:43.000Z","dependencies_parsed_at":"2023-09-16T09:27:34.757Z","dependency_job_id":null,"html_url":"https://github.com/matt-dray/choosethis","commit_stats":null,"previous_names":["matt-dray/choosethis"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matt-dray%2Fchoosethis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matt-dray%2Fchoosethis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matt-dray%2Fchoosethis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matt-dray%2Fchoosethis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/matt-dray","download_url":"https://codeload.github.com/matt-dray/choosethis/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246742989,"owners_count":20826444,"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","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":["cli","r-package","r-stats"],"created_at":"2024-10-27T11:25:10.095Z","updated_at":"2025-04-02T02:27:51.199Z","avatar_url":"https://github.com/matt-dray.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\",\n  fig.path = \"man/figures/\",\n  out.width = \"100%\",\n  eval = FALSE\n)\n```\n\n# {choosethis}\n\n\u003c!-- badges: start --\u003e\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[![Blog post](https://img.shields.io/badge/rostrum.blog-post-008900?labelColor=000000\u0026logo=data%3Aimage%2Fgif%3Bbase64%2CR0lGODlhEAAQAPEAAAAAABWCBAAAAAAAACH5BAlkAAIAIf8LTkVUU0NBUEUyLjADAQAAACwAAAAAEAAQAAAC55QkISIiEoQQQgghRBBCiCAIgiAIgiAIQiAIgSAIgiAIQiAIgRAEQiAQBAQCgUAQEAQEgYAgIAgIBAKBQBAQCAKBQEAgCAgEAoFAIAgEBAKBIBAQCAQCgUAgEAgCgUBAICAgICAgIBAgEBAgEBAgEBAgECAgICAgECAQIBAQIBAgECAgICAgICAgECAQECAQICAgICAgICAgEBAgEBAgEBAgICAgICAgECAQIBAQIBAgECAgICAgIBAgECAQECAQIBAgICAgIBAgIBAgEBAgECAgECAgICAgICAgECAgECAgQIAAAQIKAAAh%2BQQJZAACACwAAAAAEAAQAAAC55QkIiESIoQQQgghhAhCBCEIgiAIgiAIQiAIgSAIgiAIQiAIgRAEQiAQBAQCgUAQEAQEgYAgIAgIBAKBQBAQCAKBQEAgCAgEAoFAIAgEBAKBIBAQCAQCgUAgEAgCgUBAICAgICAgIBAgEBAgEBAgEBAgECAgICAgECAQIBAQIBAgECAgICAgICAgECAQECAQICAgICAgICAgEBAgEBAgEBAgICAgICAgECAQIBAQIBAgECAgICAgIBAgECAQECAQIBAgICAgIBAgIBAgEBAgECAgECAgICAgICAgECAgECAgQIAAAQIKAAA7)](https://www.rostrum.blog/posts/2023-09-17-chosethis/)\n\u003c!-- badges: end --\u003e\n\nDemonstrations of using [{cli}](https://cran.r-project.org/package=cli) to present clickable links to the user in their console. Read more in [the accompanying blogpost](https://www.rostrum.blog/posts/2023-09-17-chosethis/).\n\n\u003cimg src='man/figures/demo.gif' fig-alt=\"A gif of the R console. The function 'begin' is run from the 'choosethis' package, which prints the message 'you reach a fork in the road'. Two clickable options are presented: go left or go right. The user clicks 'go right' and this automatically runs the 'right' function and outputs the text 'you died'.\"\u003e\n\n## Demos\n\nYou can install {choosethis} from GitHub.\n\n```{r install}\nif (!require(remotes)) install.packages(\"remotes\")\ninstall_github(\"matt-dray/choosethis\")\nlibrary(choosethis)\n```\n\n### 1. Text adventure\n\nTo start a new game:\n\n```{r begin}\nbegin()\n```\n```\nYou reach a fork in the road.\n* Go left\n* Go right\n```\n\nIf your console supports links (e.g. RStudio), then the words 'left' and 'right' in the printout will be clickable (not shown above). Click one and you'll be taken to the next choice. If unsupported, you'll be shown functions to copy-paste yourself.\n\n### 2. Summarise a data.frame\n\nTo begin:\n\n```{r means}\nask_col_mean(ChickWeight)\n```\n```\nWhat column would you like the mean of?\n* weight\n* Time\n```\n\nIf your console supports links (e.g. RStudio), then the column names in the printout (`weight`, `Time`) will be clickable (not shown above). Click one and you'll be returned the mean value for that column.\n\n## Theory\n\nThe [{cli} package](https://cran.r-project.org/package=cli) lets you present [clickable ANSI links](https://cli.r-lib.org/reference/links.html) to the user in supported terminals, such as RStudio.\n\n`choosethis::begin()` uses [cli::ansi_has_hyperlink_support()](https://cli.r-lib.org/reference/style_hyperlink.html) to discover whether a user's terminal can support these links. If links aren't supported, then the underlying expression will be presented to the user instead of a clickable link.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatt-dray%2Fchoosethis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatt-dray%2Fchoosethis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatt-dray%2Fchoosethis/lists"}