From aa2d1037efd9ee1e1a988f6fc26de1a34f4a8a98 Mon Sep 17 00:00:00 2001 From: olivroy <52606734+olivroy@users.noreply.github.com> Date: Mon, 29 Apr 2024 16:49:15 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20olivroy/?= =?UTF-8?q?reuseme@8d967d93187193d3c459ab5607a59624ec3638dd=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkgdown.yml | 2 +- reference/link_issue.html | 5 ----- search.json | 2 +- sitemap.xml | 3 --- 4 files changed, 2 insertions(+), 10 deletions(-) diff --git a/pkgdown.yml b/pkgdown.yml index cdb7f78..982ab64 100644 --- a/pkgdown.yml +++ b/pkgdown.yml @@ -2,7 +2,7 @@ pandoc: 3.1.11 pkgdown: 2.0.9 pkgdown_sha: ~ articles: {} -last_built: 2024-04-29T15:34Z +last_built: 2024-04-29T16:48Z urls: reference: https://olivroy.github.io/reuseme/reference article: https://olivroy.github.io/reuseme/articles diff --git a/reference/link_issue.html b/reference/link_issue.html index c59b9ef..2171c7d 100644 --- a/reference/link_issue.html +++ b/reference/link_issue.html @@ -73,11 +73,6 @@

Value

Details

Note: doesn't support without /

-
-

See also

-

Other inline markup internal helpers: -escape_markup()

-

Examples

diff --git a/search.json b/search.json index 68559c4..ba70b76 100644 --- a/search.json +++ b/search.json @@ -1 +1 @@ -[{"path":"https://olivroy.github.io/reuseme/CONTRIBUTING.html","id":null,"dir":"","previous_headings":"","what":"Contributing to reuseme","title":"Contributing to reuseme","text":"outlines propose change reuseme. detailed discussion contributing tidyverse packages, please see development contributing guide code review principles.","code":""},{"path":"https://olivroy.github.io/reuseme/CONTRIBUTING.html","id":"fixing-typos","dir":"","previous_headings":"","what":"Fixing typos","title":"Contributing to reuseme","text":"can fix typos, spelling mistakes, grammatical errors documentation directly using GitHub web interface, long changes made source file. generally means ’ll need edit roxygen2 comments .R, .Rd file. can find .R file generates .Rd reading comment first line.","code":""},{"path":"https://olivroy.github.io/reuseme/CONTRIBUTING.html","id":"bigger-changes","dir":"","previous_headings":"","what":"Bigger changes","title":"Contributing to reuseme","text":"want make bigger change, ’s good idea first file issue make sure someone team agrees ’s needed. ’ve found bug, please file issue illustrates bug minimal reprex (also help write unit test, needed). See guide create great issue advice.","code":""},{"path":"https://olivroy.github.io/reuseme/CONTRIBUTING.html","id":"pull-request-process","dir":"","previous_headings":"Bigger changes","what":"Pull request process","title":"Contributing to reuseme","text":"Fork package clone onto computer. haven’t done , recommend using usethis::create_from_github(\"olivroy/reuseme\", fork = TRUE). Install development dependencies devtools::install_dev_deps(), make sure package passes R CMD check running devtools::check(). R CMD check doesn’t pass cleanly, ’s good idea ask help continuing. Create Git branch pull request (PR). recommend using usethis::pr_init(\"brief-description--change\"). Make changes, commit git, create PR running usethis::pr_push(), following prompts browser. title PR briefly describe change. body PR contain Fixes #issue-number. user-facing changes, add bullet top NEWS.md (.e. just first header). Follow style described https://style.tidyverse.org/news.html.","code":""},{"path":"https://olivroy.github.io/reuseme/CONTRIBUTING.html","id":"code-style","dir":"","previous_headings":"Bigger changes","what":"Code style","title":"Contributing to reuseme","text":"New code follow tidyverse style guide. can use styler package apply styles, please don’t restyle code nothing PR. use roxygen2, Markdown syntax, documentation. use testthat unit tests. Contributions test cases included easier accept.","code":""},{"path":"https://olivroy.github.io/reuseme/CONTRIBUTING.html","id":"debugging-proj_outline","dir":"","previous_headings":"Bigger changes","what":"Debugging proj_outline()","title":"Contributing to reuseme","text":"define_outline_criteria() underlying o_is_*() changing logic around constitutes outline element define_outline_criteria() item shows outline, seems like false positive, keep_outline_element(): element missing outline. define_important_element() element important 1 display_outline_element() outline element doesn’t show expected (.e right position, enough much stripping), edit construct_outline_link() link (formatting) seems incorrect. print.outline_report() want improve styling","code":""},{"path":"https://olivroy.github.io/reuseme/CONTRIBUTING.html","id":"enhancing-proj_outline","dir":"","previous_headings":"Bigger changes","what":"Enhancing proj_outline()","title":"Contributing to reuseme","text":"Example ggtitle Create new function R/outline-criteria.R (place right define_outline_criteria()) Add test function Create new variable define_outline_criteria() Add correct criteria keep_outline_element() careful markdown vs non-markdown (.e. section title ) Create new conditions display display_outline_element() important, add criteria define_important_element() Look result. Ideally, add _ref/-analysis.R, shows somehow snapshots.","code":"# Detects ggtitle(') o_is_ggtitle <- function(x) { stringr::str_detect(x, \"ggtitle\\\\(['\\\"]\") } # Run use_test(\"outline-criteria\") # add where appropriate (at the end probably) test_that(\"o_is_ggtitle() works\", { expect_true(o_is_ggtitle(\"ggtitle('Main plot title')\")) }) is_ggtitle = o_is_ggtitle(content), # in our case we'd go in the third section (generic) and would add | is_ggtitle is_ggtitle = stringr::str_remove_all(content, \"(ggplot2\\\\:\\\\:)?ggtitle\\\\([\\\"']|[\\\"']$\")"},{"path":"https://olivroy.github.io/reuseme/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2023 reuseme authors Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"https://olivroy.github.io/reuseme/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Olivier Roy. Author, maintainer.","code":""},{"path":"https://olivroy.github.io/reuseme/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Roy O (2024). reuseme: Collections Utility Functions Work Across Projects. R package version 0.0.0.9009, https://github.com/olivroy/reuseme, https://olivroy.github.io/reuseme/.","code":"@Manual{, title = {reuseme: Collections of Utility Functions to Work Across Projects}, author = {Olivier Roy}, year = {2024}, note = {R package version 0.0.0.9009, https://github.com/olivroy/reuseme}, url = {https://olivroy.github.io/reuseme/}, }"},{"path":"https://olivroy.github.io/reuseme/index.html","id":"reuseme","dir":"","previous_headings":"","what":"Collections of Utility Functions to Work Across Projects","title":"Collections of Utility Functions to Work Across Projects","text":"goal reuseme provide utility functions project management across RStudio projects. Sometimes, manage multiple things , don’t time edits. may need switch quickly project, add things browse certain file replications across projects. Sometimes, hard . reuseme also aims help overcome things don’t like Windows.","code":""},{"path":"https://olivroy.github.io/reuseme/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Collections of Utility Functions to Work Across Projects","text":"can install development version reuseme like :","code":"# R-universe install.packages('reuseme', repos = c('https://olivroy.r-universe.dev', 'https://cloud.r-project.org')) # From GitHub pak::pak(\"olivroy/reuseme\")"},{"path":"https://olivroy.github.io/reuseme/index.html","id":"getting-started","dir":"","previous_headings":"","what":"Getting started","title":"Collections of Utility Functions to Work Across Projects","text":"reuseme adapted standard workflow, recommended (find resources) Anyone working RStudio (recent version hyperlink support) Work RStudio projects RStudio projects organized centralized location computer RStudio projects Version controlled git (optional, recommended avoid surprises! need hosted repositories like GitLab GitHub) working Windows (macOS supported, things designed Windows) use machine human readable paths (.e. spaces, special characters) (Tip: don’t hesitate rename files, can take away pain long run! take advantage reuseme, highly recommended set following option .Rprofile enable functions like proj_switch(), proj_list(), use_todo() optimized.","code":"options(reuseme.reposdir = c(\"~/rrr\", \"any-other-directories-that-contain-rstudio-projects\"))"},{"path":"https://olivroy.github.io/reuseme/index.html","id":"example","dir":"","previous_headings":"","what":"Example","title":"Collections of Utility Functions to Work Across Projects","text":"Since package meant interactive use, may lot code. takes advantage cli hyperlinks improve productivity. functions meant used RStudio, RStudio Projects, widely tested outside context. interactive sessions, can use screenshot() function access image clipboard save .png figures/ images/directory RStudio project. reuseme helps work across projects, proj_switch() function. proj_switch() works lot like usethis::proj_activate() advantage typing project name, instead full path. default, reuseme looks options(reuseme.reposdir), vector paths repositories located. Personally, use ~/rrr (projects) ~/rrr-forks (projects contribute ). supplying proj argument, many functions just offer choose, user interface built cli hyperlinks.","code":"library(reuseme) ## basic example code"},{"path":"https://olivroy.github.io/reuseme/index.html","id":"extend-usethis-functionality","dir":"","previous_headings":"Example","what":"Extend usethis functionality","title":"Collections of Utility Functions to Work Across Projects","text":"usethis fantastic manage workflow within project, harder across projects. want work across projects usethis, need provide full path project. reuseme, just use project name! usethis vs reuseme `browse_pkg(“usethis”) Click hyperlinks correspond query browse_package(“usethis”) Type correct number corresponds browseVignettes(“usethis”) Open usethis vs reuseme","code":""},{"path":[]},{"path":"https://olivroy.github.io/reuseme/reference/browse_pkg.html","id":null,"dir":"Reference","previous_headings":"","what":"Browse pkgdown site if it exists — browse_pkg","title":"Browse pkgdown site if it exists — browse_pkg","text":"wrapper around usethis::browse_package() aims identifying package website. looks link DESCRIPTION.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/browse_pkg.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Browse pkgdown site if it exists — browse_pkg","text":"","code":"browse_pkg( package = NULL, open = rlang::is_interactive(), news_only = FALSE, ref_only = FALSE, vignettes_show = TRUE )"},{"path":"https://olivroy.github.io/reuseme/reference/browse_pkg.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Browse pkgdown site if it exists — browse_pkg","text":"package Name package. NULL, active project targeted, regardless whether R package . open Whether open pkgdown site browser. news_only news link shown? ref_only reference index show? vignettes_show vignette information displayed console?","code":""},{"path":"https://olivroy.github.io/reuseme/reference/browse_pkg.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Browse pkgdown site if it exists — browse_pkg","text":"package website URL, invisibly. (ref_only, news_only, reference index URL Changelog URL).","code":""},{"path":"https://olivroy.github.io/reuseme/reference/browse_pkg.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Browse pkgdown site if it exists — browse_pkg","text":"","code":"if (FALSE) { # interactive() browse_pkg(\"reuseme\") browse_pkg() }"},{"path":"https://olivroy.github.io/reuseme/reference/case_if_any.html","id":null,"dir":"Reference","previous_headings":"","what":"case-when, but checks for all matches, returns a character — case_if_any","title":"case-when, but checks for all matches, returns a character — case_if_any","text":"case evaluated cases character vector match element determines corresponding value output vector. cases match, .default used. function allows assign multiple values character value, can handy EDA.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/case_if_any.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"case-when, but checks for all matches, returns a character — case_if_any","text":"","code":"case_if_any(..., .default = \"\", .sep = \";\", .drop_empty = TRUE)"},{"path":"https://olivroy.github.io/reuseme/reference/case_if_any.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"case-when, but checks for all matches, returns a character — case_if_any","text":"... sequence two-sided formulas. left hand side (LHS) determines values match case. right hand side (RHS) provides replacement value. LHS inputs must evaluate logical vectors. RHS inputs coerced common type. inputs recycled common size. said, encourage LHS inputs size. Recycling mainly useful RHS inputs, might supply size 1 input recycled size LHS inputs. NULL inputs ignored. .default value used LHS inputs return either FALSE NA. .default must size 1 size common size computed .... .default participates computation common type RHS inputs. NA values LHS conditions treated like FALSE, meaning result locations assigned .default value. handle missing values conditions differently, must explicitly catch another condition fall .default. typically involves variation .na(x) ~ value tailored usage case_when(). NULL, default, missing value used. .sep, separator answers. (default ;), substring text .drop_empty drop match returned. (Defaults TRUE legibility), FALSE, can used easily tidyr::separate_wider/longer_delim()","code":""},{"path":"https://olivroy.github.io/reuseme/reference/case_if_any.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"case-when, but checks for all matches, returns a character — case_if_any","text":"vector size common size computed inputs ... type common type RHS inputs ....","code":""},{"path":"https://olivroy.github.io/reuseme/reference/case_if_any.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"case-when, but checks for all matches, returns a character — case_if_any","text":"","code":"case_if_any( mtcars$vs == 1 ~ \"vs = 1\", mtcars$mpg > 150 ~ \"I have mpg > 150\" ) #> [1] \"\" \"\" \"vs = 1\" \"vs = 1\" \"\" \"vs = 1\" \"\" \"vs = 1\" #> [9] \"vs = 1\" \"vs = 1\" \"vs = 1\" \"\" \"\" \"\" \"\" \"\" #> [17] \"\" \"vs = 1\" \"vs = 1\" \"vs = 1\" \"vs = 1\" \"\" \"\" \"\" #> [25] \"\" \"vs = 1\" \"\" \"vs = 1\" \"\" \"\" \"\" \"vs = 1\" case_if_any( mtcars$vs == 1 ~ \"Woww\", mtcars$mpg > 15 ~ \"QW\", mtcars$qsec > 18 ~ \"ooh lalal\", .sep = \";\", .default = NA ) #> [1] \"QW\" \"QW\" \"Woww;QW;ooh lalal\" #> [4] \"Woww;QW;ooh lalal\" \"QW\" \"Woww;QW;ooh lalal\" #> [7] NA \"Woww;QW;ooh lalal\" \"Woww;QW;ooh lalal\" #> [10] \"Woww;QW;ooh lalal\" \"Woww;QW;ooh lalal\" \"QW\" #> [13] \"QW\" \"QW\" NA #> [16] NA NA \"Woww;QW;ooh lalal\" #> [19] \"Woww;QW;ooh lalal\" \"Woww;QW;ooh lalal\" \"Woww;QW;ooh lalal\" #> [22] \"QW\" \"QW\" NA #> [25] \"QW\" \"Woww;QW;ooh lalal\" \"QW\" #> [28] \"Woww;QW\" \"QW\" \"QW\" #> [31] NA \"Woww;QW;ooh lalal\""},{"path":"https://olivroy.github.io/reuseme/reference/check_referenced_files.html","id":null,"dir":"Reference","previous_headings":"","what":"Check if files referenced in source files exist in a current dir — check_referenced_files","title":"Check if files referenced in source files exist in a current dir — check_referenced_files","text":"goes source files (.R/.qmd etc.), identifies data files (.csv, .xlsx) read written Search system files exist.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/check_referenced_files.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check if files referenced in source files exist in a current dir — check_referenced_files","text":"","code":"check_referenced_files(path = \".\", quiet = FALSE)"},{"path":"https://olivroy.github.io/reuseme/reference/check_referenced_files.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Check if files referenced in source files exist in a current dir — check_referenced_files","text":"path directory search quiet Whether print messages?","code":""},{"path":"https://olivroy.github.io/reuseme/reference/check_referenced_files.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check if files referenced in source files exist in a current dir — check_referenced_files","text":"logical","code":""},{"path":"https://olivroy.github.io/reuseme/reference/check_referenced_files.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Check if files referenced in source files exist in a current dir — check_referenced_files","text":"Still WIP, can add code false positive needed. find genuine referenced files, exclude different paths created fs::path() file.path() glue::glue() checked fs::file_exists(), file.exists() Deleted fs::file_delete(), unlink()","code":""},{"path":"https://olivroy.github.io/reuseme/reference/count_pct.html","id":null,"dir":"Reference","previous_headings":"","what":"Count observations by group and compute percentage — count_pct","title":"Count observations by group and compute percentage — count_pct","text":"count_pct() lets quickly count unique values one variables: df |> count_pct(, b) calculates percentage group afterwards","code":""},{"path":"https://olivroy.github.io/reuseme/reference/count_pct.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Count observations by group and compute percentage — count_pct","text":"","code":"count_pct( .data, ..., label = FALSE, accuracy = NULL, name = NULL, sort = FALSE )"},{"path":"https://olivroy.github.io/reuseme/reference/count_pct.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Count observations by group and compute percentage — count_pct","text":".data data frame, data frame extension (e.g. tibble), lazy data frame (e.g. dbplyr dtplyr). ... Variables group . label logical, TRUE, return vector character accuracy number round . Use (e.g.) 0.01 show 2 decimal places precision. NULL, default, uses heuristic ensure breaks minimum number digits needed show difference adjacent values. Applied rescaled data. name name new column output. omitted, default n. already column called n, use nn. column called n nn, 'll use nnn, , adding ns gets new name. sort TRUE, show largest groups top.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/count_pct.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Count observations by group and compute percentage — count_pct","text":"object type .data. count() add_count() group transiently, output groups input.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/count_pct.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Count observations by group and compute percentage — count_pct","text":"Wrapper function around dplyr::count()","code":""},{"path":[]},{"path":"https://olivroy.github.io/reuseme/reference/count_pct.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Count observations by group and compute percentage — count_pct","text":"","code":"count_pct(mtcars, cyl) #> cyl n percent #> 1 4 11 0.34375 #> 2 6 7 0.21875 #> 3 8 14 0.43750 mtcars |> dplyr::group_by(vs) |> count_pct(cyl) #> # A tibble: 5 × 4 #> # Groups: vs [2] #> vs cyl n percent #> #> 1 0 4 1 0.0556 #> 2 0 6 3 0.167 #> 3 0 8 14 0.778 #> 4 1 4 10 0.714 #> 5 1 6 4 0.286 mtcars |> dplyr::group_by(vs) |> count_pct(cyl, label = TRUE) #> # A tibble: 5 × 4 #> # Groups: vs [2] #> vs cyl n percent #> #> 1 0 4 1 5.6% #> 2 0 6 3 16.7% #> 3 0 8 14 77.8% #> 4 1 4 10 71.4% #> 5 1 6 4 28.6% mtcars |> dplyr::group_by(vs) |> count_pct(cyl, label = TRUE, accuracy = 0.1) #> # A tibble: 5 × 4 #> # Groups: vs [2] #> vs cyl n percent #> #> 1 0 4 1 5.6% #> 2 0 6 3 16.7% #> 3 0 8 14 77.8% #> 4 1 4 10 71.4% #> 5 1 6 4 28.6%"},{"path":"https://olivroy.github.io/reuseme/reference/eda-identity.html","id":null,"dir":"Reference","previous_headings":"","what":"Helpers that return the same value — eda-identity","title":"Helpers that return the same value — eda-identity","text":"share *_identity suffix, silent non-interactive sessions. handy create clickable hyperlinks modify current state analysis. inspired pillar::glimpse, tibble::view. Look original functions parameters.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/eda-identity.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Helpers that return the same value — eda-identity","text":"","code":"names_identity(x, nrows = NULL, extra_msg = NULL) count_identity( x, ..., sort = TRUE, name = NULL, nrows = NULL, extra_msg = NULL ) mutate_identity( x, ..., .keep = NULL, .before = NULL, nrows = NULL, extra_msg = NULL ) slice_identity( x, ..., .by = NULL, .preserve = FALSE, nrows = NULL, extra_msg = NULL ) slice_min_identity( x, order_by, ..., n, prop, by = NULL, with_ties = TRUE, na_rm = TRUE, nrows = NULL, extra_msg = NULL ) slice_max_identity( x, order_by, ..., n, prop, by = NULL, with_ties = TRUE, na_rm = TRUE, nrows = NULL, extra_msg = NULL ) arrange_identity(x, ..., .by_group = FALSE, nrows = NULL, extra_msg = NULL) distinct_identity(x, ..., .keep_all = FALSE, nrows = NULL, extra_msg = NULL) filter_identity(x, ..., .by = NULL, nrows = NULL, extra_msg = NULL) slice_sample_identity( x, ..., n, prop, by = NULL, weight_by = NULL, replace = FALSE, nrows = NULL, extra_msg = NULL ) filter_if_any_identity( x, ..., .by = NULL, .keep_new_var = FALSE, nrows = NULL, extra_msg = NULL ) slice_min_max_identity( x, order_by, ..., n, prop, by = NULL, with_ties = TRUE, na_rm = FALSE, each = TRUE, ascending = TRUE, nrows = NULL, extra_msg = NULL ) slice_group_sample_identity( x, group_var = NULL, n_groups = 1, nrows = NULL, extra_msg = NULL )"},{"path":"https://olivroy.github.io/reuseme/reference/eda-identity.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Helpers that return the same value — eda-identity","text":"x main object (data.frame, functions accept vector.) (aka .data dplyr functions, naming x throughout.) nrows Number rows print. extra_msg character vector observations print console, notes taken related transformation. name, sort, .keep_all, ., , n_groups, group_var, ..., n, prop, with_ties, order_by, .keep, ., , na_rm, weight_by, replace, .by_group, .keep_new_var, .preserve, ascending Check original functions.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/eda-identity.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Helpers that return the same value — eda-identity","text":"x, original input (invisibly) returned. (allowing *_identity() functions used pipeline) print extra_msg console interactive sessions.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/eda-identity.html","id":"use-cases-advantages","dir":"Reference","previous_headings":"","what":"Use cases / advantages","title":"Helpers that return the same value — eda-identity","text":"Like many reuseme functions, useful interactive sessions print result interactive sessions (quiet non-interactive.) Create runnable hyperlinks (August 2023, RStudio forbids runnable hyperlinks base functions, non-package functions. (.e. ::)) Use pipelines explore data Use rlang::is_interactive() base::interactive() easier control test options(rlang_interactive) Use original functions final results. count_identity() also prints percentages. slice_identity() can useful resolve many--many warnings dplyr join functions.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/eda-identity.html","id":"caution","dir":"Reference","previous_headings":"","what":"Caution","title":"Helpers that return the same value — eda-identity","text":"put end pipeline name first argument, avoid conflicts case column data named x. functions small tweaks mutate_identity() prints distinct values, uses .keep = \"used\", .= 0, unless specified improve display. count_identity() wrapper count_pct() (wrapper dplyr::count()), count_identity() may fail already variable named n. slice_min/max_identity() relocates target column beginning. filter_identity() prints short message rows returned.","code":""},{"path":[]},{"path":"https://olivroy.github.io/reuseme/reference/eda-identity.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Helpers that return the same value — eda-identity","text":"","code":"withr::local_options(rlang_interactive = TRUE) # Workflow to explore mtcars mtcars |> filter_identity(mpg > 21, extra_msg = c(\"Wow, these rows are very interesting.\")) |> count_identity( vs, extra_msg = c( \"Woo, there are 14 obs with vs = 1, 18 obs with vs = 0\", \"The split is 56%-43%\" ) ) |> dplyr::filter(disp > 150) # after all, I need only disp > 150 #> mpg cyl disp hp drat wt qsec vs am gear carb #> Mazda RX4 21.0 6 160.0 110 3.90 2.620 16.46 0 1 4 4 #> Mazda RX4 Wag 21.0 6 160.0 110 3.90 2.875 17.02 0 1 4 4 #> Hornet 4 Drive 21.4 6 258.0 110 3.08 3.215 19.44 1 0 3 1 #> Hornet Sportabout 18.7 8 360.0 175 3.15 3.440 17.02 0 0 3 2 #> Valiant 18.1 6 225.0 105 2.76 3.460 20.22 1 0 3 1 #> Duster 360 14.3 8 360.0 245 3.21 3.570 15.84 0 0 3 4 #> Merc 280 19.2 6 167.6 123 3.92 3.440 18.30 1 0 4 4 #> Merc 280C 17.8 6 167.6 123 3.92 3.440 18.90 1 0 4 4 #> Merc 450SE 16.4 8 275.8 180 3.07 4.070 17.40 0 0 3 3 #> Merc 450SL 17.3 8 275.8 180 3.07 3.730 17.60 0 0 3 3 #> Merc 450SLC 15.2 8 275.8 180 3.07 3.780 18.00 0 0 3 3 #> Cadillac Fleetwood 10.4 8 472.0 205 2.93 5.250 17.98 0 0 3 4 #> Lincoln Continental 10.4 8 460.0 215 3.00 5.424 17.82 0 0 3 4 #> Chrysler Imperial 14.7 8 440.0 230 3.23 5.345 17.42 0 0 3 4 #> Dodge Challenger 15.5 8 318.0 150 2.76 3.520 16.87 0 0 3 2 #> AMC Javelin 15.2 8 304.0 150 3.15 3.435 17.30 0 0 3 2 #> Camaro Z28 13.3 8 350.0 245 3.73 3.840 15.41 0 0 3 4 #> Pontiac Firebird 19.2 8 400.0 175 3.08 3.845 17.05 0 0 3 2 #> Ford Pantera L 15.8 8 351.0 264 4.22 3.170 14.50 0 1 5 4 #> Maserati Bora 15.0 8 301.0 335 3.54 3.570 14.60 0 1 5 8"},{"path":"https://olivroy.github.io/reuseme/reference/escape_markup.html","id":null,"dir":"Reference","previous_headings":"","what":"escape inline markup in case of problems — escape_markup","title":"escape inline markup in case of problems — escape_markup","text":"escape inline markup case problems","code":""},{"path":"https://olivroy.github.io/reuseme/reference/escape_markup.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"escape inline markup in case of problems — escape_markup","text":"","code":"escape_markup(x)"},{"path":"https://olivroy.github.io/reuseme/reference/escape_markup.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"escape inline markup in case of problems — escape_markup","text":"x character vector","code":""},{"path":"https://olivroy.github.io/reuseme/reference/escape_markup.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"escape inline markup in case of problems — escape_markup","text":"character vector inline markup scrubbed.","code":""},{"path":[]},{"path":"https://olivroy.github.io/reuseme/reference/escape_markup.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"escape inline markup in case of problems — escape_markup","text":"","code":"escape_markup(\"{gt}\") #> [1] \"{{gt}}\" escape_markup(\"{.file {here}}\") #> [1] \"{.file {.url here}}\" escape_markup(\"multi problems {{gt}} to {gt} to {.file gt} to {.file {gt}}\") #> [1] \"multi problems {{gt}} to {{gt}} to {.file gt} to {.file {.url gt}}\""},{"path":"https://olivroy.github.io/reuseme/reference/extract_cell_value.html","id":null,"dir":"Reference","previous_headings":"","what":"Elegant wrapper around filter and pull — extract_cell_value","title":"Elegant wrapper around filter and pull — extract_cell_value","text":"can useful trying extract value somewhere, one col represents unique id.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/extract_cell_value.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Elegant wrapper around filter and pull — extract_cell_value","text":"","code":"extract_cell_value( data, var, filter, name = NULL, length = NULL, unique = FALSE )"},{"path":"https://olivroy.github.io/reuseme/reference/extract_cell_value.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Elegant wrapper around filter and pull — extract_cell_value","text":"data data.frame var variable specified : literal variable name positive integer, giving position counting left negative integer, giving position counting right. default returns last column (assumption column created recently). argument taken expression supports quasiquotation (can unquote column names column locations). filter filter name variable name (default, look rownames), can quoted (safer). length fixed length check output unique logical. return unique values?","code":""},{"path":"https://olivroy.github.io/reuseme/reference/extract_cell_value.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Elegant wrapper around filter and pull — extract_cell_value","text":"(named) character vector (name specified)","code":""},{"path":"https://olivroy.github.io/reuseme/reference/extract_cell_value.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Elegant wrapper around filter and pull — extract_cell_value","text":"","code":"# extract the skin_color for C-3PO extract_cell_value( data = dplyr::starwars, var = skin_color, filter = name == \"C-3PO\", length = 1 # ensure the length will be 1. ) #> [1] \"gold\" # will return a named vector of mpg (as mtcars has rownames.) mtcars |> extract_cell_value( var = mpg, filter = vs == 0 ) #> Mazda RX4 Mazda RX4 Wag Hornet Sportabout Duster 360 #> 21.0 21.0 18.7 14.3 #> Merc 450SE Merc 450SL Merc 450SLC Cadillac Fleetwood #> 16.4 17.3 15.2 10.4 #> Lincoln Continental Chrysler Imperial Dodge Challenger AMC Javelin #> 10.4 14.7 15.5 15.2 #> Camaro Z28 Pontiac Firebird Porsche 914-2 Ford Pantera L #> 13.3 19.2 26.0 15.8 #> Ferrari Dino Maserati Bora #> 19.7 15.0 # Extract hair color for all people extract_cell_value( data = dplyr::starwars, var = skin_color, filter = TRUE, name = \"name\" # ensure it is a named vector that corresponds to their unique ID ) #> Luke Skywalker C-3PO R2-D2 #> \"fair\" \"gold\" \"white, blue\" #> Darth Vader Leia Organa Owen Lars #> \"white\" \"light\" \"light\" #> Beru Whitesun Lars R5-D4 Biggs Darklighter #> \"light\" \"white, red\" \"light\" #> Obi-Wan Kenobi Anakin Skywalker Wilhuff Tarkin #> \"fair\" \"fair\" \"fair\" #> Chewbacca Han Solo Greedo #> \"unknown\" \"fair\" \"green\" #> Jabba Desilijic Tiure Wedge Antilles Jek Tono Porkins #> \"green-tan, brown\" \"fair\" \"fair\" #> Yoda Palpatine Boba Fett #> \"green\" \"pale\" \"fair\" #> IG-88 Bossk Lando Calrissian #> \"metal\" \"green\" \"dark\" #> Lobot Ackbar Mon Mothma #> \"light\" \"brown mottle\" \"fair\" #> Arvel Crynyd Wicket Systri Warrick Nien Nunb #> \"fair\" \"brown\" \"grey\" #> Qui-Gon Jinn Nute Gunray Finis Valorum #> \"fair\" \"mottled green\" \"fair\" #> Padmé Amidala Jar Jar Binks Roos Tarpals #> \"light\" \"orange\" \"grey\" #> Rugor Nass Ric Olié Watto #> \"green\" \"fair\" \"blue, grey\" #> Sebulba Quarsh Panaka Shmi Skywalker #> \"grey, red\" \"dark\" \"fair\" #> Darth Maul Bib Fortuna Ayla Secura #> \"red\" \"pale\" \"blue\" #> Ratts Tyerel Dud Bolt Gasgano #> \"grey, blue\" \"blue, grey\" \"white, blue\" #> Ben Quadinaros Mace Windu Ki-Adi-Mundi #> \"grey, green, yellow\" \"dark\" \"pale\" #> Kit Fisto Eeth Koth Adi Gallia #> \"green\" \"brown\" \"dark\" #> Saesee Tiin Yarael Poof Plo Koon #> \"pale\" \"white\" \"orange\" #> Mas Amedda Gregar Typho Cordé #> \"blue\" \"dark\" \"light\" #> Cliegg Lars Poggle the Lesser Luminara Unduli #> \"fair\" \"green\" \"yellow\" #> Barriss Offee Dormé Dooku #> \"yellow\" \"light\" \"fair\" #> Bail Prestor Organa Jango Fett Zam Wesell #> \"tan\" \"tan\" \"fair, green, yellow\" #> Dexter Jettster Lama Su Taun We #> \"brown\" \"grey\" \"grey\" #> Jocasta Nu R4-P17 Wat Tambor #> \"fair\" \"silver, red\" \"green, grey\" #> San Hill Shaak Ti Grievous #> \"grey\" \"red, blue, white\" \"brown, white\" #> Tarfful Raymus Antilles Sly Moore #> \"brown\" \"light\" \"pale\" #> Tion Medon Finn Rey #> \"grey\" \"dark\" \"light\" #> Poe Dameron BB8 Captain Phasma #> \"light\" \"none\" \"none\""},{"path":"https://olivroy.github.io/reuseme/reference/filter_if_any.html","id":null,"dir":"Reference","previous_headings":"","what":"Keep rows that match one of the conditions — filter_if_any","title":"Keep rows that match one of the conditions — filter_if_any","text":"filter_if_any() function used subset data frame, retaining rows satisfy least one conditions. retained, row must produce value TRUE one conditions. Note condition evaluates NA row dropped, (hence function) unlike base subsetting [.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/filter_if_any.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Keep rows that match one of the conditions — filter_if_any","text":"","code":"filter_if_any(.data, ..., .by = NULL, .keep_new_var = FALSE)"},{"path":"https://olivroy.github.io/reuseme/reference/filter_if_any.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Keep rows that match one of the conditions — filter_if_any","text":".data data frame ... Expressions return logical value, defined terms variables .data. multiple expressions included, combined | operator. rows one conditions evaluate TRUE kept. .See dplyr::dplyr_by. .keep_new_var TRUE, remove newly created variables.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/filter_if_any.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Keep rows that match one of the conditions — filter_if_any","text":"object type .data. output following properties: Rows subset input, appear order. Columns modified (.keep_new_var = FALSE. Data frame attributes preserved.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/filter_if_any.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Keep rows that match one of the conditions — filter_if_any","text":"reason function simplify call like Basically, just shortcut mutate(.data, new_lgl_vars) + filter(if_any(new_lgl_vars)) + select(-new_lgl_vars). allows mutate_like syntax filter(if_any(...)). Caution: still work dplyr::across(), use regular filter(if_any()) syntax.","code":"# with dplyr::filter dat |> dplyr::filter(vs == 1 | is.na(vs)) data |> dplyr::mutate(cond1 = vs == 1, cond2 = is.na(vs)) |> dplyr::filter(dplyr::if_any(starts_with(\"cond\"))) dat |> filter_if_any(vs == 1, is.na(vs))"},{"path":"https://olivroy.github.io/reuseme/reference/filter_if_any.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Keep rows that match one of the conditions — filter_if_any","text":"","code":"mtcars |> dplyr::filter(cyl > 5 | mpg == 2) #> mpg cyl disp hp drat wt qsec vs am gear carb #> Mazda RX4 21.0 6 160.0 110 3.90 2.620 16.46 0 1 4 4 #> Mazda RX4 Wag 21.0 6 160.0 110 3.90 2.875 17.02 0 1 4 4 #> Hornet 4 Drive 21.4 6 258.0 110 3.08 3.215 19.44 1 0 3 1 #> Hornet Sportabout 18.7 8 360.0 175 3.15 3.440 17.02 0 0 3 2 #> Valiant 18.1 6 225.0 105 2.76 3.460 20.22 1 0 3 1 #> Duster 360 14.3 8 360.0 245 3.21 3.570 15.84 0 0 3 4 #> Merc 280 19.2 6 167.6 123 3.92 3.440 18.30 1 0 4 4 #> Merc 280C 17.8 6 167.6 123 3.92 3.440 18.90 1 0 4 4 #> Merc 450SE 16.4 8 275.8 180 3.07 4.070 17.40 0 0 3 3 #> Merc 450SL 17.3 8 275.8 180 3.07 3.730 17.60 0 0 3 3 #> Merc 450SLC 15.2 8 275.8 180 3.07 3.780 18.00 0 0 3 3 #> Cadillac Fleetwood 10.4 8 472.0 205 2.93 5.250 17.98 0 0 3 4 #> Lincoln Continental 10.4 8 460.0 215 3.00 5.424 17.82 0 0 3 4 #> Chrysler Imperial 14.7 8 440.0 230 3.23 5.345 17.42 0 0 3 4 #> Dodge Challenger 15.5 8 318.0 150 2.76 3.520 16.87 0 0 3 2 #> AMC Javelin 15.2 8 304.0 150 3.15 3.435 17.30 0 0 3 2 #> Camaro Z28 13.3 8 350.0 245 3.73 3.840 15.41 0 0 3 4 #> Pontiac Firebird 19.2 8 400.0 175 3.08 3.845 17.05 0 0 3 2 #> Ford Pantera L 15.8 8 351.0 264 4.22 3.170 14.50 0 1 5 4 #> Ferrari Dino 19.7 6 145.0 175 3.62 2.770 15.50 0 1 5 6 #> Maserati Bora 15.0 8 301.0 335 3.54 3.570 14.60 0 1 5 8 mtcars |> dplyr::filter(!(!cyl > 5 & !mpg == 2)) #> mpg cyl disp hp drat wt qsec vs am gear carb #> Mazda RX4 21.0 6 160.0 110 3.90 2.620 16.46 0 1 4 4 #> Mazda RX4 Wag 21.0 6 160.0 110 3.90 2.875 17.02 0 1 4 4 #> Hornet 4 Drive 21.4 6 258.0 110 3.08 3.215 19.44 1 0 3 1 #> Hornet Sportabout 18.7 8 360.0 175 3.15 3.440 17.02 0 0 3 2 #> Valiant 18.1 6 225.0 105 2.76 3.460 20.22 1 0 3 1 #> Duster 360 14.3 8 360.0 245 3.21 3.570 15.84 0 0 3 4 #> Merc 280 19.2 6 167.6 123 3.92 3.440 18.30 1 0 4 4 #> Merc 280C 17.8 6 167.6 123 3.92 3.440 18.90 1 0 4 4 #> Merc 450SE 16.4 8 275.8 180 3.07 4.070 17.40 0 0 3 3 #> Merc 450SL 17.3 8 275.8 180 3.07 3.730 17.60 0 0 3 3 #> Merc 450SLC 15.2 8 275.8 180 3.07 3.780 18.00 0 0 3 3 #> Cadillac Fleetwood 10.4 8 472.0 205 2.93 5.250 17.98 0 0 3 4 #> Lincoln Continental 10.4 8 460.0 215 3.00 5.424 17.82 0 0 3 4 #> Chrysler Imperial 14.7 8 440.0 230 3.23 5.345 17.42 0 0 3 4 #> Dodge Challenger 15.5 8 318.0 150 2.76 3.520 16.87 0 0 3 2 #> AMC Javelin 15.2 8 304.0 150 3.15 3.435 17.30 0 0 3 2 #> Camaro Z28 13.3 8 350.0 245 3.73 3.840 15.41 0 0 3 4 #> Pontiac Firebird 19.2 8 400.0 175 3.08 3.845 17.05 0 0 3 2 #> Ford Pantera L 15.8 8 351.0 264 4.22 3.170 14.50 0 1 5 4 #> Ferrari Dino 19.7 6 145.0 175 3.62 2.770 15.50 0 1 5 6 #> Maserati Bora 15.0 8 301.0 335 3.54 3.570 14.60 0 1 5 8 mtcars |> filter_if_any(cyl > 5, vs == 0) #> mpg cyl disp hp drat wt qsec vs am gear carb #> Mazda RX4 21.0 6 160.0 110 3.90 2.620 16.46 0 1 4 4 #> Mazda RX4 Wag 21.0 6 160.0 110 3.90 2.875 17.02 0 1 4 4 #> Hornet 4 Drive 21.4 6 258.0 110 3.08 3.215 19.44 1 0 3 1 #> Hornet Sportabout 18.7 8 360.0 175 3.15 3.440 17.02 0 0 3 2 #> Valiant 18.1 6 225.0 105 2.76 3.460 20.22 1 0 3 1 #> Duster 360 14.3 8 360.0 245 3.21 3.570 15.84 0 0 3 4 #> Merc 280 19.2 6 167.6 123 3.92 3.440 18.30 1 0 4 4 #> Merc 280C 17.8 6 167.6 123 3.92 3.440 18.90 1 0 4 4 #> Merc 450SE 16.4 8 275.8 180 3.07 4.070 17.40 0 0 3 3 #> Merc 450SL 17.3 8 275.8 180 3.07 3.730 17.60 0 0 3 3 #> Merc 450SLC 15.2 8 275.8 180 3.07 3.780 18.00 0 0 3 3 #> Cadillac Fleetwood 10.4 8 472.0 205 2.93 5.250 17.98 0 0 3 4 #> Lincoln Continental 10.4 8 460.0 215 3.00 5.424 17.82 0 0 3 4 #> Chrysler Imperial 14.7 8 440.0 230 3.23 5.345 17.42 0 0 3 4 #> Dodge Challenger 15.5 8 318.0 150 2.76 3.520 16.87 0 0 3 2 #> AMC Javelin 15.2 8 304.0 150 3.15 3.435 17.30 0 0 3 2 #> Camaro Z28 13.3 8 350.0 245 3.73 3.840 15.41 0 0 3 4 #> Pontiac Firebird 19.2 8 400.0 175 3.08 3.845 17.05 0 0 3 2 #> Porsche 914-2 26.0 4 120.3 91 4.43 2.140 16.70 0 1 5 2 #> Ford Pantera L 15.8 8 351.0 264 4.22 3.170 14.50 0 1 5 4 #> Ferrari Dino 19.7 6 145.0 175 3.62 2.770 15.50 0 1 5 6 #> Maserati Bora 15.0 8 301.0 335 3.54 3.570 14.60 0 1 5 8"},{"path":"https://olivroy.github.io/reuseme/reference/link_issue.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a cli link to a GitHub issue — link_issue","title":"Create a cli link to a GitHub issue — link_issue","text":"RStudio, links issues automatically recognized. function creates cli ansi links entries form rstudio/rstudio#1100","code":""},{"path":"https://olivroy.github.io/reuseme/reference/link_issue.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a cli link to a GitHub issue — link_issue","text":"","code":"link_issue(x)"},{"path":"https://olivroy.github.io/reuseme/reference/link_issue.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a cli link to a GitHub issue — link_issue","text":"x string, usually lines files contains issue numbers.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/link_issue.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a cli link to a GitHub issue — link_issue","text":"formatted linked issue GitHub issue","code":""},{"path":"https://olivroy.github.io/reuseme/reference/link_issue.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a cli link to a GitHub issue — link_issue","text":"Note: support without /","code":""},{"path":[]},{"path":"https://olivroy.github.io/reuseme/reference/link_issue.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a cli link to a GitHub issue — link_issue","text":"","code":"link_issue(c(\"We really need rstudio/gt#1469 to be fixed.\")) |> cli::cli_bullets() #> We really need rstudio/gt#1469 () to #> be fixed."},{"path":"https://olivroy.github.io/reuseme/reference/mark_todo_as_complete.html","id":null,"dir":"Reference","previous_headings":"","what":"Remove a TODO/WORK/FIXME item from a file — mark_todo_as_complete","title":"Remove a TODO/WORK/FIXME item from a file — mark_todo_as_complete","text":"Function meant wrapped {.run} hyperlinks file_outline(). basically removes line file.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/mark_todo_as_complete.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Remove a TODO/WORK/FIXME item from a file — mark_todo_as_complete","text":"","code":"mark_todo_as_complete(line_id, file, regexp, rm_line = NULL)"},{"path":"https://olivroy.github.io/reuseme/reference/mark_todo_as_complete.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Remove a TODO/WORK/FIXME item from a file — mark_todo_as_complete","text":"line_id line number (single integer) file Path file regexp regexp assess file content changed. rm_line logical NULL remove full line file (TODO, FIXME items), else WORK, remove WORK tag remove tag (.e. TODO, WORK, FIXME)","code":""},{"path":"https://olivroy.github.io/reuseme/reference/mark_todo_as_complete.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Remove a TODO/WORK/FIXME item from a file — mark_todo_as_complete","text":"Writes file corrections, returns new line content invisibly.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/na_if2.html","id":null,"dir":"Reference","previous_headings":"","what":"Transform to NA any of the condition — na_if2","title":"Transform to NA any of the condition — na_if2","text":"function similar dplyr::na_if(), 2 differences. values y never recycled. two ways provide condition. values logical vector.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/na_if2.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Transform to NA any of the condition — na_if2","text":"","code":"na_if2(x, values, expr)"},{"path":"https://olivroy.github.io/reuseme/reference/na_if2.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Transform to NA any of the condition — na_if2","text":"x vector. values vector values. length values = 1, actually preferable use dplyr::na_if() clarity. expr logical vector length x","code":""},{"path":"https://olivroy.github.io/reuseme/reference/na_if2.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Transform to NA any of the condition — na_if2","text":"x NA values required.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/na_if2.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Transform to NA any of the condition — na_if2","text":"","code":"vec <- c(0, 1, 1, 2) vec2 <- c(\"Here\", \"not\", NA, \"Here\") # NA all 2s # You can actually use dplyr::na_if() in this case dplyr::na_if(vec, 2) #> [1] 0 1 1 NA # NA all 1 and 2 na_if2(vec, c(1, 2)) #> [1] 0 NA NA NA na_if2(vec, expr = vec2 == \"Here\") #> [1] NA 1 1 NA"},{"path":"https://olivroy.github.io/reuseme/reference/named-base.html","id":null,"dir":"Reference","previous_headings":"","what":"Helpers that can return a named vector — named-base","title":"Helpers that can return a named vector — named-base","text":"Base R keeps names various places, drops elsewhere functions use frequently, like max, unique","code":""},{"path":"https://olivroy.github.io/reuseme/reference/named-base.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Helpers that can return a named vector — named-base","text":"","code":"min_named(x, na.rm = FALSE, all_matches = FALSE) max_named(x, na.rm = FALSE, all_matches = FALSE) unique_named(x)"},{"path":"https://olivroy.github.io/reuseme/reference/named-base.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Helpers that can return a named vector — named-base","text":"x vector na.rm remove NA? all_matches FALSE (default), return first match, similar .min() / .max() TRUE, return named vector values corresponding max value.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/named-base.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Helpers that can return a named vector — named-base","text":"min/max_named(all_matches = FALSE), named vector length 1. Otherwise, named vector.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/named-base.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Helpers that can return a named vector — named-base","text":"","code":"max_named(c(\"this guy\" = 2, \"that guy\" = 3)) #> that guy #> 3 unique_named(c(\"this guy\" = 2, \"that guy\" = 3, \"this guy\" = 2)) #> this guy that guy #> 2 3 # returns the same as base R for unnamed input unique_named(c(1, 2, 3, 3)) #> [1] 1 2 3 # returns all values min_named(c(\"x\" = 1, \"y\" = 1, \"ww\" = 2), all_matches = FALSE) #> x #> 1 # TODO is usable with `extract_cell_value()`"},{"path":"https://olivroy.github.io/reuseme/reference/open_rs_doc.html","id":null,"dir":"Reference","previous_headings":"","what":"Open a Document in RStudio — open_rs_doc","title":"Open a Document in RStudio — open_rs_doc","text":"Wrapper around rstudioapi::documentOpen(), fs paths, consistency. file opened, clickable hyperlink displayed.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/open_rs_doc.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Open a Document in RStudio — open_rs_doc","text":"","code":"open_rs_doc(path, line = -1L, col = -1L, move_cursor = TRUE) active_rs_doc()"},{"path":"https://olivroy.github.io/reuseme/reference/open_rs_doc.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Open a Document in RStudio — open_rs_doc","text":"path path document. line line document navigate . col column document navigate . move_cursor Boolean; move cursor requested location opening document?","code":""},{"path":"https://olivroy.github.io/reuseme/reference/open_rs_doc.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Open a Document in RStudio — open_rs_doc","text":"Invisibly returns document id","code":""},{"path":"https://olivroy.github.io/reuseme/reference/open_rs_doc.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Open a Document in RStudio — open_rs_doc","text":"active_rs_doc() wrapper around rstudioapi::documentPath() handles unsaved files gracefully","code":""},{"path":"https://olivroy.github.io/reuseme/reference/open_rs_doc.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Open a Document in RStudio — open_rs_doc","text":"","code":"if (FALSE) { # open the fictious file.R at line 5 open_rs_doc(\"file.R\", line = 5) }"},{"path":"https://olivroy.github.io/reuseme/reference/outdated_pkgs.html","id":null,"dir":"Reference","previous_headings":"","what":"Looks for outdated packages — outdated_pkgs","title":"Looks for outdated packages — outdated_pkgs","text":"checks binaries, advantage notifying packages newly available CRAN, without binaries available. Installing packages source can longer, hence advantage waiting days binaries. takes advantage pak's capacities allow install packages Windows without restarting session.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/outdated_pkgs.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Looks for outdated packages — outdated_pkgs","text":"","code":"outdated_pkgs(type = c(\"binary\", \"source\"))"},{"path":"https://olivroy.github.io/reuseme/reference/outdated_pkgs.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Looks for outdated packages — outdated_pkgs","text":"type Type package look (\"binary\" \"source\")","code":""},{"path":"https://olivroy.github.io/reuseme/reference/outdated_pkgs.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Looks for outdated packages — outdated_pkgs","text":"list packages can updated, links news, pkgdown site.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/outdated_pkgs.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Looks for outdated packages — outdated_pkgs","text":"","code":"# \\donttest{ outdated_pkgs() #> Warning: Couldn't check for outdated packages. #> Can't connect to your default repository. #> Are you offline? # }"},{"path":"https://olivroy.github.io/reuseme/reference/outline.html","id":null,"dir":"Reference","previous_headings":"","what":"Print interactive outline of file sections — outline","title":"Print interactive outline of file sections — outline","text":"RStudio project, directories fail trying map unsaved file.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/outline.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Print interactive outline of file sections — outline","text":"","code":"file_outline( regex_outline = NULL, path = active_rs_doc(), work_only = TRUE, alpha = FALSE, dir_common = NULL, print_todo = TRUE, recent_only = FALSE, width = cli::console_width(), n_colors = NULL ) proj_outline( regex_outline = NULL, proj = proj_get2(), work_only = TRUE, dir_tree = FALSE, alpha = FALSE, recent_only = FALSE ) dir_outline( regex_outline = NULL, path = \".\", work_only = TRUE, dir_tree = FALSE, alpha = FALSE, recent_only = FALSE )"},{"path":"https://olivroy.github.io/reuseme/reference/outline.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Print interactive outline of file sections — outline","text":"regex_outline string regex search outline path, proj character vector file paths, project. Defaults active file, project directory. rstudioapi::documentPath() work_only TRUE, (default), show work items first. Set FALSE want see full outline. WORK combine regex_outline alpha Whether show alphabetical order dir_common (use ) print_todo include TODOs file outline? FALSE, print less verbose output sections. recent_only Show outline recent files width Width (internal) n_colors Number colours (Internal) dir_tree TRUE, print fs::dir_tree() non-R files directory","code":""},{"path":"https://olivroy.github.io/reuseme/reference/outline.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Print interactive outline of file sections — outline","text":"outline_report object contains information. Inherits tbl_df. symbol show recently modified files.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/outline.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Print interactive outline of file sections — outline","text":"work_only set TRUE, function return outline # WORK comment path. work_only = TRUE effect regex_outline. functions default file_outline() prints outline active document RStudio proj_outline() prints outline active project RStudio dir_outline() prints outline active working directory default proj_* dir_ call file_outline. parser opinioneted robust based regexps. better file parser, explore options, like lightparser, {roxygen2} show TODO items offer link mark complete","code":""},{"path":"https://olivroy.github.io/reuseme/reference/outline.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Print interactive outline of file sections — outline","text":"","code":"file <- fs::path_package(\"reuseme\", \"example-file\", \"outline-script.R\") file_outline(path = file) #> #> ── `example-file/outline-script.R` 🦐 Example for `file_outline()` #> `i` Load packages #> `i` Wrangle + visualize data #> `i` A great title #> `i` TODO improve this Viz!- `Done✔?` # Remove TODO file_outline(path = file, print_todo = FALSE, alpha = TRUE) #> #> ── `example-file/outline-script.R` 🦐 Example for `file_outline()` #> `i` Example for `file_outline()` #> `i` Load packages #> `i` Wrangle + visualize data # interact with data frame file_outline(path = file) |> dplyr::as_tibble() #> # A tibble: 5 × 31 #> file line_id content file_ext is_md is_test_file is_cli_info is_doc_title #> #> 1 /home/ru… 1 \"# Exa… R FALSE FALSE FALSE FALSE #> 2 /home/ru… 2 \"# Loa… R FALSE FALSE FALSE FALSE #> 3 /home/ru… 5 \"# Wra… R FALSE FALSE FALSE FALSE #> 4 /home/ru… 10 \" t… R FALSE FALSE FALSE FALSE #> 5 /home/ru… 12 \"# TOD… R FALSE FALSE FALSE FALSE #> # ℹ 23 more variables: is_chunk_cap , is_chunk_cap_next , #> # is_test_name , is_section_title , is_section_title_source , #> # is_tab_or_plot_title , is_a_comment_or_code , #> # is_todo_fixme , before_and_after_empty , n_leading_hash , #> # is_second_level_heading_or_more , is_cross_ref , #> # outline_el , is_subtitle , importance , link , #> # file_path , is_saved_doc , text_in_link , style_fun , … if (FALSE) { # interactive() # These all work on the active file / project or directory. file_outline() proj_outline() dir_outline() # Like proj_switch(), proj_outline() accepts a project }"},{"path":"https://olivroy.github.io/reuseme/reference/proj-reuseme.html","id":null,"dir":"Reference","previous_headings":"","what":"Interact with different RStudio projects — proj-reuseme","title":"Interact with different RStudio projects — proj-reuseme","text":"package offers many ways interact different local RStudio projects.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/proj-reuseme.html","id":"setup","dir":"Reference","previous_headings":"","what":"Setup","title":"Interact with different RStudio projects — proj-reuseme","text":"take advantage functionality, first set options(reuseme.reposdir) .Rprofile file. Access usethis::edit_r_profile(). recommend add following. works better store RStudio projects common directories. Inspired usethis options","code":"if (interactive()) { options(reuseme.reposdir = c(\"~/rrr/\", \"~/packages\", \"~/rrr-work/\")) }"},{"path":"https://olivroy.github.io/reuseme/reference/proj-reuseme.html","id":"capabilities-","dir":"Reference","previous_headings":"","what":"Capabilities.","title":"Interact with different RStudio projects — proj-reuseme","text":"Assumes project named \"learning\" project outline Add TODO item learning project Get file outline file.R \"learning\" Move new project session lot features already present RStudio usethis. However, managing many projects, recent projects list can difficult handle. Passing full project name usethis::proj_activate() long.","code":"proj_outline(proj = \"learning) use_todo(\"learning::Learn this\") proj_file(\"file\", \"learning\") proj_switch(\"learning\")"},{"path":[]},{"path":"https://olivroy.github.io/reuseme/reference/proj_file.html","id":null,"dir":"Reference","previous_headings":"","what":"Active a file at location — proj_file","title":"Active a file at location — proj_file","text":"Active file location","code":""},{"path":"https://olivroy.github.io/reuseme/reference/proj_file.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Active a file at location — proj_file","text":"","code":"proj_file(file = NULL, proj = NULL, regex_outline = NULL)"},{"path":"https://olivroy.github.io/reuseme/reference/proj_file.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Active a file at location — proj_file","text":"file filename regexp file inside proj proj project path file proj_list() regex_outline regular expression look ","code":""},{"path":"https://olivroy.github.io/reuseme/reference/proj_file.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Active a file at location — proj_file","text":"file outline multiple matches found","code":""},{"path":[]},{"path":"https://olivroy.github.io/reuseme/reference/proj_file.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Active a file at location — proj_file","text":"","code":"try(proj_file(\"A non-existent file\")) #> Error in proj_file(\"A non-existent file\") : #> No match found for \"A non-existent file\" in #> /home/runner/work/reuseme/reuseme"},{"path":"https://olivroy.github.io/reuseme/reference/proj_list.html","id":null,"dir":"Reference","previous_headings":"","what":"Returns a named project list options — proj_list","title":"Returns a named project list options — proj_list","text":"peeks options(reuseme.reposdir) find projects.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/proj_list.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Returns a named project list options — proj_list","text":"","code":"proj_list(dirs = getOption(\"reuseme.reposdir\"))"},{"path":"https://olivroy.github.io/reuseme/reference/proj_list.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Returns a named project list options — proj_list","text":"dirs directories want list projects.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/proj_list.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Returns a named project list options — proj_list","text":"named character vector project name ","code":""},{"path":[]},{"path":"https://olivroy.github.io/reuseme/reference/proj_switch.html","id":null,"dir":"Reference","previous_headings":"","what":"Opens a RStudio project in a new session — proj_switch","title":"Opens a RStudio project in a new session — proj_switch","text":"specified, generate hyperlinks call usethis::proj_activate(). proj_switch() looks options(reuseme.reposdir).","code":""},{"path":"https://olivroy.github.io/reuseme/reference/proj_switch.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Opens a RStudio project in a new session — proj_switch","text":"","code":"proj_switch(proj = NULL, new_session = TRUE)"},{"path":"https://olivroy.github.io/reuseme/reference/proj_switch.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Opens a RStudio project in a new session — proj_switch","text":"proj name project located default locations NULL new_session open new session?","code":""},{"path":"https://olivroy.github.io/reuseme/reference/proj_switch.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Opens a RStudio project in a new session — proj_switch","text":"Single logical value indicating current session modified.","code":""},{"path":[]},{"path":"https://olivroy.github.io/reuseme/reference/quarto_help.html","id":null,"dir":"Reference","previous_headings":"","what":"Show links to Quarto documentation of interest — quarto_help","title":"Show links to Quarto documentation of interest — quarto_help","text":"opinionated links need access periodically. Easily accessible R console.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/quarto_help.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Show links to Quarto documentation of interest — quarto_help","text":"","code":"quarto_help(subject = NULL)"},{"path":"https://olivroy.github.io/reuseme/reference/quarto_help.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Show links to Quarto documentation of interest — quarto_help","text":"subject character vector (optional)","code":""},{"path":"https://olivroy.github.io/reuseme/reference/quarto_help.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Show links to Quarto documentation of interest — quarto_help","text":"possible links help invisibly","code":""},{"path":"https://olivroy.github.io/reuseme/reference/quarto_help.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Show links to Quarto documentation of interest — quarto_help","text":"","code":"gt_help <- quarto_help() |> tibble::enframe() |> gt::gt() |> gt::fmt_url(value) # \\dontshow{ gt_help |> gt::as_raw_html() #>
#> #> #> #> #> #>
name<\/th> #> value<\/th> #> <\/tr> #> <\/thead> #>
dashboard<\/td> #> https://quarto.org/docs/dashboards/data-display.html<\/a><\/span><\/td><\/tr> #>
manuscript<\/td> #> https://quarto.org/docs/manuscripts/authoring/rstudio.html<\/a><\/span><\/td><\/tr> #>
revealjs<\/td> #> https://quarto.org/docs/presentations/revealjs/<\/a><\/span><\/td><\/tr> #>
blog<\/td> #> https://quarto.org/docs/websites/website-blog.html<\/a><\/span><\/td><\/tr> #>
theme<\/td> #> https://quarto.org/docs/dashboards/theming.html#theme-options<\/a><\/span><\/td><\/tr> #>
param<\/td> #> https://quarto.org/docs/computations/parameters.html#knitr<\/a><\/span><\/td><\/tr> #>
quartopub<\/td> #> https://quarto.org/docs/publishing/quarto-pub.html<\/a><\/span><\/td><\/tr> #>
gh-actions<\/td> #> https://quarto.org/docs/publishing/github-pages.html<\/a><\/span><\/td><\/tr> #>
netlify<\/td> #> https://quarto.org/docs/publishing/netlify.html<\/a><\/span><\/td><\/tr> #>
gallery<\/td> #> https://quarto.org/docs/gallery/<\/a><\/span><\/td><\/tr> #>
news<\/td> #> https://quarto.org/docs/download/<\/a><\/span><\/td><\/tr> #>
shortcode<\/td> #> https://quarto.org/docs/extensions/shortcodes.html<\/a><\/span><\/td><\/tr> #> <\/tbody> #> #> #> <\/table> #> <\/div> # }"},{"path":"https://olivroy.github.io/reuseme/reference/rename_files2.html","id":null,"dir":"Reference","previous_headings":"","what":"Rename an output or a data file and watch for references — rename_files2","title":"Rename an output or a data file and watch for references — rename_files2","text":"function can improve workflow. inspired usethis::rename_files(), scope oriented towards analysis script.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/rename_files2.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Rename an output or a data file and watch for references — rename_files2","text":"","code":"rename_files2( old, new, warn_conflicts = c(\"default\", \"all\", \"exact\", \"none\"), overwrite = FALSE, action = c(\"rename\", \"test\"), force = deprecated() )"},{"path":"https://olivroy.github.io/reuseme/reference/rename_files2.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Rename an output or a data file and watch for references — rename_files2","text":"old, new Old new file names (without extensions). warn_conflicts One \"default\": check thoroughly depending situation. moving directory, \"\" otherwise. \"\" (larger scope: old = \"data/-streets.csv|my_streets\" check objects named my_streets, files like -streets.R, etc.), \"exact\" search \"data/-streets.csv\" documents \"none\" search references documents rename. overwrite whether overwrite new already exists. careful. action One \"rename\" \"test\" force Use warn_conflicts instead force = TRUE","code":""},{"path":"https://olivroy.github.io/reuseme/reference/rename_files2.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Rename an output or a data file and watch for references — rename_files2","text":"new renaming succeeded. Mostly called side-effects","code":""},{"path":"https://olivroy.github.io/reuseme/reference/rename_files2.html","id":"use-case","dir":"Reference","previous_headings":"","what":"Use case","title":"Rename an output or a data file and watch for references — rename_files2","text":"say analysis work certain subject. want rename figure clarity. example, input file named data/-streets.csv now want rename rename_files2() , renames files. Look potential name conflict Look data frame name conflicts Sends information clipboard work well tend name objects using snake case naming objects snake case kebab-case. philosophy inform manual steps required actually performing file renaming. way less strict us","code":""},{"path":"https://olivroy.github.io/reuseme/reference/reuseme-package.html","id":null,"dir":"Reference","previous_headings":"","what":"reuseme: Collections of Utility Functions to Work Across Projects — reuseme-package","title":"reuseme: Collections of Utility Functions to Work Across Projects — reuseme-package","text":"Allows browse current projects, rename files safely, add screenshots project Windows. also personal library contains wrapper around common functions, dplyr readxl. takes advantage cli hyperlinks. Finally, provides custom print method tibbles, inspired janitor, readr.","code":""},{"path":[]},{"path":"https://olivroy.github.io/reuseme/reference/reuseme-package.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"reuseme: Collections of Utility Functions to Work Across Projects — reuseme-package","text":"Maintainer: Olivier Roy olivierroy71@hotmail.com","code":""},{"path":"https://olivroy.github.io/reuseme/reference/screenshot.html","id":null,"dir":"Reference","previous_headings":"","what":"Save the current image in clipboard to png in your active directory — screenshot","title":"Save the current image in clipboard to png in your active directory — screenshot","text":"screenshot saved .png directory following rules regular RStudio project (Quarto book), saved images/ directory package project, saved man/figures directory Quarto Blog project, save current post's folder. can always override defaults setting dir using shortcut Win + Shift + S, can call function!","code":""},{"path":"https://olivroy.github.io/reuseme/reference/screenshot.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Save the current image in clipboard to png in your active directory — screenshot","text":"","code":"screenshot(file = NULL, proj = proj_get(), dir = NULL)"},{"path":"https://olivroy.github.io/reuseme/reference/screenshot.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Save the current image in clipboard to png in your active directory — screenshot","text":"file file name, ideally - (kebab-case). (extension ignored) (optional, default image.png) proj project name dir directory (optional), override directory rules mentioned description. inside proj.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/screenshot.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Save the current image in clipboard to png in your active directory — screenshot","text":"full image path, invisibly.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/screenshot.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Save the current image in clipboard to png in your active directory — screenshot","text":"file name supplied, file named image0*.png created. function prompts rename file expressive name. continue numbering file named image exists. Still validate works macOS, clear whether image goes clipboard default maximum number images folder 99. (padding 2), enough. able overwrite screenshot generic name, named one possible may require retake screenshot.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/screenshot.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Save the current image in clipboard to png in your active directory — screenshot","text":"","code":"if (FALSE) { # Add an image to the clipboard # Run the following screenshot(file = \"my-new-image\") }"},{"path":"https://olivroy.github.io/reuseme/reference/slice_group_sample.html","id":null,"dir":"Reference","previous_headings":"","what":"Explore all rows in a random group — slice_group_sample","title":"Explore all rows in a random group — slice_group_sample","text":"Compared slice_sample() slice_group_sample return rows corresponding group.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/slice_group_sample.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Explore all rows in a random group — slice_group_sample","text":"","code":"slice_group_sample(data, group_var = NULL, n_groups = 1)"},{"path":"https://olivroy.github.io/reuseme/reference/slice_group_sample.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Explore all rows in a random group — slice_group_sample","text":"data data.frame group_var data grouped, ignored. n_groups Number groups sample. (passed sample(size = n_groups))","code":""},{"path":"https://olivroy.github.io/reuseme/reference/slice_group_sample.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Explore all rows in a random group — slice_group_sample","text":"data frame sample group.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/slice_group_sample.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Explore all rows in a random group — slice_group_sample","text":"","code":"set.seed(10) slice_group_sample(mtcars, group_var = vs) #> # A tibble: 18 × 11 #> mpg cyl disp hp drat wt qsec vs am gear carb #> #> 1 21 6 160 110 3.9 2.62 16.5 0 1 4 4 #> 2 21 6 160 110 3.9 2.88 17.0 0 1 4 4 #> 3 18.7 8 360 175 3.15 3.44 17.0 0 0 3 2 #> 4 14.3 8 360 245 3.21 3.57 15.8 0 0 3 4 #> 5 16.4 8 276. 180 3.07 4.07 17.4 0 0 3 3 #> 6 17.3 8 276. 180 3.07 3.73 17.6 0 0 3 3 #> 7 15.2 8 276. 180 3.07 3.78 18 0 0 3 3 #> 8 10.4 8 472 205 2.93 5.25 18.0 0 0 3 4 #> 9 10.4 8 460 215 3 5.42 17.8 0 0 3 4 #> 10 14.7 8 440 230 3.23 5.34 17.4 0 0 3 4 #> 11 15.5 8 318 150 2.76 3.52 16.9 0 0 3 2 #> 12 15.2 8 304 150 3.15 3.44 17.3 0 0 3 2 #> 13 13.3 8 350 245 3.73 3.84 15.4 0 0 3 4 #> 14 19.2 8 400 175 3.08 3.84 17.0 0 0 3 2 #> 15 26 4 120. 91 4.43 2.14 16.7 0 1 5 2 #> 16 15.8 8 351 264 4.22 3.17 14.5 0 1 5 4 #> 17 19.7 6 145 175 3.62 2.77 15.5 0 1 5 6 #> 18 15 8 301 335 3.54 3.57 14.6 0 1 5 8 mtcars |> dplyr::group_by(vs) |> slice_group_sample() #> # A tibble: 18 × 11 #> # Groups: vs [1] #> mpg cyl disp hp drat wt qsec vs am gear carb #> #> 1 21 6 160 110 3.9 2.62 16.5 0 1 4 4 #> 2 21 6 160 110 3.9 2.88 17.0 0 1 4 4 #> 3 18.7 8 360 175 3.15 3.44 17.0 0 0 3 2 #> 4 14.3 8 360 245 3.21 3.57 15.8 0 0 3 4 #> 5 16.4 8 276. 180 3.07 4.07 17.4 0 0 3 3 #> 6 17.3 8 276. 180 3.07 3.73 17.6 0 0 3 3 #> 7 15.2 8 276. 180 3.07 3.78 18 0 0 3 3 #> 8 10.4 8 472 205 2.93 5.25 18.0 0 0 3 4 #> 9 10.4 8 460 215 3 5.42 17.8 0 0 3 4 #> 10 14.7 8 440 230 3.23 5.34 17.4 0 0 3 4 #> 11 15.5 8 318 150 2.76 3.52 16.9 0 0 3 2 #> 12 15.2 8 304 150 3.15 3.44 17.3 0 0 3 2 #> 13 13.3 8 350 245 3.73 3.84 15.4 0 0 3 4 #> 14 19.2 8 400 175 3.08 3.84 17.0 0 0 3 2 #> 15 26 4 120. 91 4.43 2.14 16.7 0 1 5 2 #> 16 15.8 8 351 264 4.22 3.17 14.5 0 1 5 4 #> 17 19.7 6 145 175 3.62 2.77 15.5 0 1 5 6 #> 18 15 8 301 335 3.54 3.57 14.6 0 1 5 8"},{"path":"https://olivroy.github.io/reuseme/reference/slice_min_max.html","id":null,"dir":"Reference","previous_headings":"","what":"Subset rows using their positions — slice_min_max","title":"Subset rows using their positions — slice_min_max","text":"wrapper around dplyr::bind_rows(), dplyr::slice_min(), dplyr::slice_max()","code":""},{"path":"https://olivroy.github.io/reuseme/reference/slice_min_max.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Subset rows using their positions — slice_min_max","text":"","code":"slice_min_max( .data, order_by, ..., n, prop, by = NULL, with_ties = TRUE, na_rm = FALSE, each = TRUE, ascending = TRUE )"},{"path":"https://olivroy.github.io/reuseme/reference/slice_min_max.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Subset rows using their positions — slice_min_max","text":".data data frame, data frame extension (e.g. tibble), lazy data frame (e.g. dbplyr dtplyr). See Methods, , details. order_by Variable function variables order . order multiple variables, wrap data frame tibble. ... Arguments passed methods. n, prop Provide either n, number rows, prop, proportion rows select. neither supplied, n = 1 used. n greater number rows group (prop > 1), result silently truncated group size. prop rounded towards zero generate integer number rows. negative value n prop subtracted group size. example, n = -2 group 5 rows select 5 - 2 = 3 rows; prop = -0.25 8 rows select 8 * (1 - 0.25) = 6 rows. Optionally, selection columns group just operation, functioning alternative group_by(). details examples, see ?dplyr_by. with_ties ties kept together? default, TRUE, may return rows request. Use FALSE ignore ties, return first n rows. na_rm missing values order_by removed result? FALSE, NA values sorted end (like arrange()), included insufficient non-missing values reach n/prop. FALSE, n prop passed dplyr::slice_min() dplyr::slice_max() divided 2. (use ceiling() n ) ascending Return output ascending order. (min top)","code":""},{"path":"https://olivroy.github.io/reuseme/reference/slice_min_max.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Subset rows using their positions — slice_min_max","text":"object type .data. output following properties: row may appear 0, 1, many times output. minmax column added show min, max. Groups modified. Data frame attributes preserved.","code":""},{"path":[]},{"path":"https://olivroy.github.io/reuseme/reference/slice_min_max.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Subset rows using their positions — slice_min_max","text":"","code":"# in the presence of ties. mtcars |> dplyr::slice_min(cyl, n = 1) #> mpg cyl disp hp drat wt qsec vs am gear carb #> Datsun 710 22.8 4 108.0 93 3.85 2.320 18.61 1 1 4 1 #> Merc 240D 24.4 4 146.7 62 3.69 3.190 20.00 1 0 4 2 #> Merc 230 22.8 4 140.8 95 3.92 3.150 22.90 1 0 4 2 #> Fiat 128 32.4 4 78.7 66 4.08 2.200 19.47 1 1 4 1 #> Honda Civic 30.4 4 75.7 52 4.93 1.615 18.52 1 1 4 2 #> Toyota Corolla 33.9 4 71.1 65 4.22 1.835 19.90 1 1 4 1 #> Toyota Corona 21.5 4 120.1 97 3.70 2.465 20.01 1 0 3 1 #> Fiat X1-9 27.3 4 79.0 66 4.08 1.935 18.90 1 1 4 1 #> Porsche 914-2 26.0 4 120.3 91 4.43 2.140 16.70 0 1 5 2 #> Lotus Europa 30.4 4 95.1 113 3.77 1.513 16.90 1 1 5 2 #> Volvo 142E 21.4 4 121.0 109 4.11 2.780 18.60 1 1 4 2 # Use with_ties = FALSE to return exactly n matches mtcars |> dplyr::slice_min(cyl, n = 1, with_ties = FALSE) #> mpg cyl disp hp drat wt qsec vs am gear carb #> Datsun 710 22.8 4 108 93 3.85 2.32 18.61 1 1 4 1 # Use each = FALSE to have n divided in each place mtcars |> slice_min_max(cyl, n = 2) #> minmax mpg cyl disp hp drat wt qsec vs am gear carb #> Datsun 710 min 22.8 4 108.0 93 3.85 2.320 18.61 1 1 4 1 #> Merc 240D min 24.4 4 146.7 62 3.69 3.190 20.00 1 0 4 2 #> Merc 230 min 22.8 4 140.8 95 3.92 3.150 22.90 1 0 4 2 #> Fiat 128 min 32.4 4 78.7 66 4.08 2.200 19.47 1 1 4 1 #> Honda Civic min 30.4 4 75.7 52 4.93 1.615 18.52 1 1 4 2 #> Toyota Corolla min 33.9 4 71.1 65 4.22 1.835 19.90 1 1 4 1 #> Toyota Corona min 21.5 4 120.1 97 3.70 2.465 20.01 1 0 3 1 #> Fiat X1-9 min 27.3 4 79.0 66 4.08 1.935 18.90 1 1 4 1 #> Porsche 914-2 min 26.0 4 120.3 91 4.43 2.140 16.70 0 1 5 2 #> Lotus Europa min 30.4 4 95.1 113 3.77 1.513 16.90 1 1 5 2 #> Volvo 142E min 21.4 4 121.0 109 4.11 2.780 18.60 1 1 4 2 #> Hornet Sportabout max 18.7 8 360.0 175 3.15 3.440 17.02 0 0 3 2 #> Duster 360 max 14.3 8 360.0 245 3.21 3.570 15.84 0 0 3 4 #> Merc 450SE max 16.4 8 275.8 180 3.07 4.070 17.40 0 0 3 3 #> Merc 450SL max 17.3 8 275.8 180 3.07 3.730 17.60 0 0 3 3 #> Merc 450SLC max 15.2 8 275.8 180 3.07 3.780 18.00 0 0 3 3 #> Cadillac Fleetwood max 10.4 8 472.0 205 2.93 5.250 17.98 0 0 3 4 #> Lincoln Continental max 10.4 8 460.0 215 3.00 5.424 17.82 0 0 3 4 #> Chrysler Imperial max 14.7 8 440.0 230 3.23 5.345 17.42 0 0 3 4 #> Dodge Challenger max 15.5 8 318.0 150 2.76 3.520 16.87 0 0 3 2 #> AMC Javelin max 15.2 8 304.0 150 3.15 3.435 17.30 0 0 3 2 #> Camaro Z28 max 13.3 8 350.0 245 3.73 3.840 15.41 0 0 3 4 #> Pontiac Firebird max 19.2 8 400.0 175 3.08 3.845 17.05 0 0 3 2 #> Ford Pantera L max 15.8 8 351.0 264 4.22 3.170 14.50 0 1 5 4 #> Maserati Bora max 15.0 8 301.0 335 3.54 3.570 14.60 0 1 5 8 # Using each = TRUE (to retun n = 2, for min, n = 2 for max) mtcars |> slice_min_max(cyl, each = TRUE, n = 2) #> minmax mpg cyl disp hp drat wt qsec vs am gear carb #> Datsun 710 min 22.8 4 108.0 93 3.85 2.320 18.61 1 1 4 1 #> Merc 240D min 24.4 4 146.7 62 3.69 3.190 20.00 1 0 4 2 #> Merc 230 min 22.8 4 140.8 95 3.92 3.150 22.90 1 0 4 2 #> Fiat 128 min 32.4 4 78.7 66 4.08 2.200 19.47 1 1 4 1 #> Honda Civic min 30.4 4 75.7 52 4.93 1.615 18.52 1 1 4 2 #> Toyota Corolla min 33.9 4 71.1 65 4.22 1.835 19.90 1 1 4 1 #> Toyota Corona min 21.5 4 120.1 97 3.70 2.465 20.01 1 0 3 1 #> Fiat X1-9 min 27.3 4 79.0 66 4.08 1.935 18.90 1 1 4 1 #> Porsche 914-2 min 26.0 4 120.3 91 4.43 2.140 16.70 0 1 5 2 #> Lotus Europa min 30.4 4 95.1 113 3.77 1.513 16.90 1 1 5 2 #> Volvo 142E min 21.4 4 121.0 109 4.11 2.780 18.60 1 1 4 2 #> Hornet Sportabout max 18.7 8 360.0 175 3.15 3.440 17.02 0 0 3 2 #> Duster 360 max 14.3 8 360.0 245 3.21 3.570 15.84 0 0 3 4 #> Merc 450SE max 16.4 8 275.8 180 3.07 4.070 17.40 0 0 3 3 #> Merc 450SL max 17.3 8 275.8 180 3.07 3.730 17.60 0 0 3 3 #> Merc 450SLC max 15.2 8 275.8 180 3.07 3.780 18.00 0 0 3 3 #> Cadillac Fleetwood max 10.4 8 472.0 205 2.93 5.250 17.98 0 0 3 4 #> Lincoln Continental max 10.4 8 460.0 215 3.00 5.424 17.82 0 0 3 4 #> Chrysler Imperial max 14.7 8 440.0 230 3.23 5.345 17.42 0 0 3 4 #> Dodge Challenger max 15.5 8 318.0 150 2.76 3.520 16.87 0 0 3 2 #> AMC Javelin max 15.2 8 304.0 150 3.15 3.435 17.30 0 0 3 2 #> Camaro Z28 max 13.3 8 350.0 245 3.73 3.840 15.41 0 0 3 4 #> Pontiac Firebird max 19.2 8 400.0 175 3.08 3.845 17.05 0 0 3 2 #> Ford Pantera L max 15.8 8 351.0 264 4.22 3.170 14.50 0 1 5 4 #> Maserati Bora max 15.0 8 301.0 335 3.54 3.570 14.60 0 1 5 8"},{"path":"https://olivroy.github.io/reuseme/reference/solve_file_name_conflict.html","id":null,"dir":"Reference","previous_headings":"","what":"Check if outdated or non-existent file is. — solve_file_name_conflict","title":"Check if outdated or non-existent file is. — solve_file_name_conflict","text":"quiet = FALSE (default) give hint file referenced.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/solve_file_name_conflict.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check if outdated or non-existent file is. — solve_file_name_conflict","text":"","code":"solve_file_name_conflict( files, regex, dir = \".\", extra_msg = NULL, quiet = FALSE, what = NULL )"},{"path":"https://olivroy.github.io/reuseme/reference/solve_file_name_conflict.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Check if outdated or non-existent file is. — solve_file_name_conflict","text":"files files search regex regex related file name search dir directory operate extra_msg Extra message pass quiet logical, informs occurrences found. (Default, FALSE) file conflicts talking ","code":""},{"path":"https://olivroy.github.io/reuseme/reference/solve_file_name_conflict.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check if outdated or non-existent file is. — solve_file_name_conflict","text":"Mostly called side-effects, return number matches (0 referenced files problmatic)","code":""},{"path":"https://olivroy.github.io/reuseme/reference/summarise_with_total.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute a summary for one group with the total included. — summarise_with_total","title":"Compute a summary for one group with the total included. — summarise_with_total","text":"function useful create end tables, apply formula group overall. can specify personalized Total value .label argument. use output summarise_with_total() tidyr::pivot_wider(), write data spreadsheet, gt::gt() . try computing afterwards. can also used plotting Changes .variable factor.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/summarise_with_total.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute a summary for one group with the total included. — summarise_with_total","text":"","code":"summarise_with_total(.data, ..., .by = NULL, .label = \"Total\", .first = TRUE)"},{"path":"https://olivroy.github.io/reuseme/reference/summarise_with_total.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute a summary for one group with the total included. — summarise_with_total","text":".data data frame, data frame extension (e.g. tibble), lazy data frame (e.g. dbplyr dtplyr). See Methods, , details. ... Name-value pairs summary functions. name name variable result. value can : vector length 1, e.g. min(x), n(), sum(.na(y)). data frame, add multiple columns single expression. Returning values size 0 >1 deprecated 1.1.0. Please use reframe() instead. . Optionally, selection columns group just operation, functioning alternative group_by(). details examples, see ?dplyr_by. .label Label total value .first total top","code":""},{"path":"https://olivroy.github.io/reuseme/reference/summarise_with_total.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute a summary for one group with the total included. — summarise_with_total","text":"ungrouped data frame total included first last row.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/summarise_with_total.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Compute a summary for one group with the total included. — summarise_with_total","text":"","code":"# works with `.by` mtcars |> summarise_with_total( x = mean(mpg), .by = vs, .label = \"All vs\" ) #> vs x #> 1 All vs 20.09062 #> 2 0 16.61667 #> 3 1 24.55714 # works with `group_by()` mtcars |> dplyr::group_by(vs) |> summarise_with_total( x = mean(mpg), .label = \"All vs\" ) #> # A tibble: 3 × 2 #> vs x #> #> 1 All vs 20.1 #> 2 0 16.6 #> 3 1 24.6"},{"path":"https://olivroy.github.io/reuseme/reference/use_todo.html","id":null,"dir":"Reference","previous_headings":"","what":"Add a TODO list by project to a TODO.R file in the base directory — use_todo","title":"Add a TODO list by project to a TODO.R file in the base directory — use_todo","text":"Creates edits TODO.R file store TODOs. default write current RStudio project.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/use_todo.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add a TODO list by project to a TODO.R file in the base directory — use_todo","text":"","code":"use_todo(todo, proj = proj_get2(), code = FALSE)"},{"path":"https://olivroy.github.io/reuseme/reference/use_todo.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add a TODO list by project to a TODO.R file in the base directory — use_todo","text":"todo character vector lines add TODO file. See details special handling. proj default, active project, arbitrary directory, RStudio project name following directories options(reuseme.destdir), uses proj_list() case. file, write . code TRUE, render code output (default text).","code":""},{"path":"https://olivroy.github.io/reuseme/reference/use_todo.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add a TODO list by project to a TODO.R file in the base directory — use_todo","text":"TODO.R file appended todo string.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/use_todo.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Add a TODO list by project to a TODO.R file in the base directory — use_todo","text":"use use_todo() version-control repository, may want use usethis::use_git_ignore(\"TODO.R\") want TODO.R file included git. using package directory, use usethis::use_build_ignore(\"TODO.R\") prevent note R CMD CHECK","code":""},{"path":[]},{"path":"https://olivroy.github.io/reuseme/reference/use_todo.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add a TODO list by project to a TODO.R file in the base directory — use_todo","text":"","code":"if (FALSE) { use_todo(\"I need to do that\") use_todo(c(\"I need to do that again\", \"youppi\")) use_todo(\"c(x, y)\", code = TRUE) use_todo(\"Here\", proj = \"my-analysis\") use_todo(c(\"my-analysis::Here\", \"I am\")) # add to a global todo. use_todo(c(\"all::Here\", \"I am\")) }"},{"path":"https://olivroy.github.io/reuseme/news/index.html","id":"reuseme-development-version","dir":"Changelog","previous_headings":"","what":"reuseme (development version)","title":"reuseme (development version)","text":"file_outline() now prints first outline element first line (encourage give informative description first line) (todos tests excluded) Improved support escaping inline markup. Add print method file_outline(). investigate ’s gone wrong, use Add file_outline() solve_file_name_conflicts() now returns number conflicts instead TRUE, FALSE rename_files2() rewritten. Now uses warn_conflicts determine . force now deprecated. now separated smaller functions easier test extend. mark_todo_as_complete() save opened documents attempting mark complete. use_todo() work platforms now. check_files_exist_in_dir() -> check_referenced_files() Require R 4.1 use base pipe rename_files2() experimental function rename data files, file names. browse_pkg() new function access pkgdown site directly. also prints links vignettes different parts website console. slice_min_max() new defaults (= TRUE)argument positions (tidy design principles) (optional arguments ...). Gains ascending parameter display max min. use_todo() allows write project use_todo(“::”) use_todo() provides handy :: shortcut `use_todo(“todo items”, “proj”) write TODO items projects. use_todo() longer fails RStudio project mark_todo_as_complete() can used multiple times sequentially throw warning (now). screenshot() works generic file paths contain numbers returns correct message. screenshot() internal cleanup. screenshot() better support Quarto blogs, gains proj argument. image saved active posts/ folder, queried using rstudioapi::documentPath(). summarise_with_total() returns factors. New na_if2() alternative dplyr::na_if() transforms x NA 1. x certain values, 2. certain logical condition TRUE.","code":"f <- proj_outline() f |> as_tibble()"}] +[{"path":"https://olivroy.github.io/reuseme/CONTRIBUTING.html","id":null,"dir":"","previous_headings":"","what":"Contributing to reuseme","title":"Contributing to reuseme","text":"outlines propose change reuseme. detailed discussion contributing tidyverse packages, please see development contributing guide code review principles.","code":""},{"path":"https://olivroy.github.io/reuseme/CONTRIBUTING.html","id":"fixing-typos","dir":"","previous_headings":"","what":"Fixing typos","title":"Contributing to reuseme","text":"can fix typos, spelling mistakes, grammatical errors documentation directly using GitHub web interface, long changes made source file. generally means ’ll need edit roxygen2 comments .R, .Rd file. can find .R file generates .Rd reading comment first line.","code":""},{"path":"https://olivroy.github.io/reuseme/CONTRIBUTING.html","id":"bigger-changes","dir":"","previous_headings":"","what":"Bigger changes","title":"Contributing to reuseme","text":"want make bigger change, ’s good idea first file issue make sure someone team agrees ’s needed. ’ve found bug, please file issue illustrates bug minimal reprex (also help write unit test, needed). See guide create great issue advice.","code":""},{"path":"https://olivroy.github.io/reuseme/CONTRIBUTING.html","id":"pull-request-process","dir":"","previous_headings":"Bigger changes","what":"Pull request process","title":"Contributing to reuseme","text":"Fork package clone onto computer. haven’t done , recommend using usethis::create_from_github(\"olivroy/reuseme\", fork = TRUE). Install development dependencies devtools::install_dev_deps(), make sure package passes R CMD check running devtools::check(). R CMD check doesn’t pass cleanly, ’s good idea ask help continuing. Create Git branch pull request (PR). recommend using usethis::pr_init(\"brief-description--change\"). Make changes, commit git, create PR running usethis::pr_push(), following prompts browser. title PR briefly describe change. body PR contain Fixes #issue-number. user-facing changes, add bullet top NEWS.md (.e. just first header). Follow style described https://style.tidyverse.org/news.html.","code":""},{"path":"https://olivroy.github.io/reuseme/CONTRIBUTING.html","id":"code-style","dir":"","previous_headings":"Bigger changes","what":"Code style","title":"Contributing to reuseme","text":"New code follow tidyverse style guide. can use styler package apply styles, please don’t restyle code nothing PR. use roxygen2, Markdown syntax, documentation. use testthat unit tests. Contributions test cases included easier accept.","code":""},{"path":"https://olivroy.github.io/reuseme/CONTRIBUTING.html","id":"debugging-proj_outline","dir":"","previous_headings":"Bigger changes","what":"Debugging proj_outline()","title":"Contributing to reuseme","text":"define_outline_criteria() underlying o_is_*() changing logic around constitutes outline element define_outline_criteria() item shows outline, seems like false positive, keep_outline_element(): element missing outline. define_important_element() element important 1 display_outline_element() outline element doesn’t show expected (.e right position, enough much stripping), edit construct_outline_link() link (formatting) seems incorrect. print.outline_report() want improve styling","code":""},{"path":"https://olivroy.github.io/reuseme/CONTRIBUTING.html","id":"enhancing-proj_outline","dir":"","previous_headings":"Bigger changes","what":"Enhancing proj_outline()","title":"Contributing to reuseme","text":"Example ggtitle Create new function R/outline-criteria.R (place right define_outline_criteria()) Add test function Create new variable define_outline_criteria() Add correct criteria keep_outline_element() careful markdown vs non-markdown (.e. section title ) Create new conditions display display_outline_element() important, add criteria define_important_element() Look result. Ideally, add _ref/-analysis.R, shows somehow snapshots.","code":"# Detects ggtitle(') o_is_ggtitle <- function(x) { stringr::str_detect(x, \"ggtitle\\\\(['\\\"]\") } # Run use_test(\"outline-criteria\") # add where appropriate (at the end probably) test_that(\"o_is_ggtitle() works\", { expect_true(o_is_ggtitle(\"ggtitle('Main plot title')\")) }) is_ggtitle = o_is_ggtitle(content), # in our case we'd go in the third section (generic) and would add | is_ggtitle is_ggtitle = stringr::str_remove_all(content, \"(ggplot2\\\\:\\\\:)?ggtitle\\\\([\\\"']|[\\\"']$\")"},{"path":"https://olivroy.github.io/reuseme/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2023 reuseme authors Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"https://olivroy.github.io/reuseme/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Olivier Roy. Author, maintainer.","code":""},{"path":"https://olivroy.github.io/reuseme/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Roy O (2024). reuseme: Collections Utility Functions Work Across Projects. R package version 0.0.0.9009, https://github.com/olivroy/reuseme, https://olivroy.github.io/reuseme/.","code":"@Manual{, title = {reuseme: Collections of Utility Functions to Work Across Projects}, author = {Olivier Roy}, year = {2024}, note = {R package version 0.0.0.9009, https://github.com/olivroy/reuseme}, url = {https://olivroy.github.io/reuseme/}, }"},{"path":"https://olivroy.github.io/reuseme/index.html","id":"reuseme","dir":"","previous_headings":"","what":"Collections of Utility Functions to Work Across Projects","title":"Collections of Utility Functions to Work Across Projects","text":"goal reuseme provide utility functions project management across RStudio projects. Sometimes, manage multiple things , don’t time edits. may need switch quickly project, add things browse certain file replications across projects. Sometimes, hard . reuseme also aims help overcome things don’t like Windows.","code":""},{"path":"https://olivroy.github.io/reuseme/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Collections of Utility Functions to Work Across Projects","text":"can install development version reuseme like :","code":"# R-universe install.packages('reuseme', repos = c('https://olivroy.r-universe.dev', 'https://cloud.r-project.org')) # From GitHub pak::pak(\"olivroy/reuseme\")"},{"path":"https://olivroy.github.io/reuseme/index.html","id":"getting-started","dir":"","previous_headings":"","what":"Getting started","title":"Collections of Utility Functions to Work Across Projects","text":"reuseme adapted standard workflow, recommended (find resources) Anyone working RStudio (recent version hyperlink support) Work RStudio projects RStudio projects organized centralized location computer RStudio projects Version controlled git (optional, recommended avoid surprises! need hosted repositories like GitLab GitHub) working Windows (macOS supported, things designed Windows) use machine human readable paths (.e. spaces, special characters) (Tip: don’t hesitate rename files, can take away pain long run! take advantage reuseme, highly recommended set following option .Rprofile enable functions like proj_switch(), proj_list(), use_todo() optimized.","code":"options(reuseme.reposdir = c(\"~/rrr\", \"any-other-directories-that-contain-rstudio-projects\"))"},{"path":"https://olivroy.github.io/reuseme/index.html","id":"example","dir":"","previous_headings":"","what":"Example","title":"Collections of Utility Functions to Work Across Projects","text":"Since package meant interactive use, may lot code. takes advantage cli hyperlinks improve productivity. functions meant used RStudio, RStudio Projects, widely tested outside context. interactive sessions, can use screenshot() function access image clipboard save .png figures/ images/directory RStudio project. reuseme helps work across projects, proj_switch() function. proj_switch() works lot like usethis::proj_activate() advantage typing project name, instead full path. default, reuseme looks options(reuseme.reposdir), vector paths repositories located. Personally, use ~/rrr (projects) ~/rrr-forks (projects contribute ). supplying proj argument, many functions just offer choose, user interface built cli hyperlinks.","code":"library(reuseme) ## basic example code"},{"path":"https://olivroy.github.io/reuseme/index.html","id":"extend-usethis-functionality","dir":"","previous_headings":"Example","what":"Extend usethis functionality","title":"Collections of Utility Functions to Work Across Projects","text":"usethis fantastic manage workflow within project, harder across projects. want work across projects usethis, need provide full path project. reuseme, just use project name! usethis vs reuseme `browse_pkg(“usethis”) Click hyperlinks correspond query browse_package(“usethis”) Type correct number corresponds browseVignettes(“usethis”) Open usethis vs reuseme","code":""},{"path":[]},{"path":"https://olivroy.github.io/reuseme/reference/browse_pkg.html","id":null,"dir":"Reference","previous_headings":"","what":"Browse pkgdown site if it exists — browse_pkg","title":"Browse pkgdown site if it exists — browse_pkg","text":"wrapper around usethis::browse_package() aims identifying package website. looks link DESCRIPTION.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/browse_pkg.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Browse pkgdown site if it exists — browse_pkg","text":"","code":"browse_pkg( package = NULL, open = rlang::is_interactive(), news_only = FALSE, ref_only = FALSE, vignettes_show = TRUE )"},{"path":"https://olivroy.github.io/reuseme/reference/browse_pkg.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Browse pkgdown site if it exists — browse_pkg","text":"package Name package. NULL, active project targeted, regardless whether R package . open Whether open pkgdown site browser. news_only news link shown? ref_only reference index show? vignettes_show vignette information displayed console?","code":""},{"path":"https://olivroy.github.io/reuseme/reference/browse_pkg.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Browse pkgdown site if it exists — browse_pkg","text":"package website URL, invisibly. (ref_only, news_only, reference index URL Changelog URL).","code":""},{"path":"https://olivroy.github.io/reuseme/reference/browse_pkg.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Browse pkgdown site if it exists — browse_pkg","text":"","code":"if (FALSE) { # interactive() browse_pkg(\"reuseme\") browse_pkg() }"},{"path":"https://olivroy.github.io/reuseme/reference/case_if_any.html","id":null,"dir":"Reference","previous_headings":"","what":"case-when, but checks for all matches, returns a character — case_if_any","title":"case-when, but checks for all matches, returns a character — case_if_any","text":"case evaluated cases character vector match element determines corresponding value output vector. cases match, .default used. function allows assign multiple values character value, can handy EDA.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/case_if_any.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"case-when, but checks for all matches, returns a character — case_if_any","text":"","code":"case_if_any(..., .default = \"\", .sep = \";\", .drop_empty = TRUE)"},{"path":"https://olivroy.github.io/reuseme/reference/case_if_any.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"case-when, but checks for all matches, returns a character — case_if_any","text":"... sequence two-sided formulas. left hand side (LHS) determines values match case. right hand side (RHS) provides replacement value. LHS inputs must evaluate logical vectors. RHS inputs coerced common type. inputs recycled common size. said, encourage LHS inputs size. Recycling mainly useful RHS inputs, might supply size 1 input recycled size LHS inputs. NULL inputs ignored. .default value used LHS inputs return either FALSE NA. .default must size 1 size common size computed .... .default participates computation common type RHS inputs. NA values LHS conditions treated like FALSE, meaning result locations assigned .default value. handle missing values conditions differently, must explicitly catch another condition fall .default. typically involves variation .na(x) ~ value tailored usage case_when(). NULL, default, missing value used. .sep, separator answers. (default ;), substring text .drop_empty drop match returned. (Defaults TRUE legibility), FALSE, can used easily tidyr::separate_wider/longer_delim()","code":""},{"path":"https://olivroy.github.io/reuseme/reference/case_if_any.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"case-when, but checks for all matches, returns a character — case_if_any","text":"vector size common size computed inputs ... type common type RHS inputs ....","code":""},{"path":"https://olivroy.github.io/reuseme/reference/case_if_any.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"case-when, but checks for all matches, returns a character — case_if_any","text":"","code":"case_if_any( mtcars$vs == 1 ~ \"vs = 1\", mtcars$mpg > 150 ~ \"I have mpg > 150\" ) #> [1] \"\" \"\" \"vs = 1\" \"vs = 1\" \"\" \"vs = 1\" \"\" \"vs = 1\" #> [9] \"vs = 1\" \"vs = 1\" \"vs = 1\" \"\" \"\" \"\" \"\" \"\" #> [17] \"\" \"vs = 1\" \"vs = 1\" \"vs = 1\" \"vs = 1\" \"\" \"\" \"\" #> [25] \"\" \"vs = 1\" \"\" \"vs = 1\" \"\" \"\" \"\" \"vs = 1\" case_if_any( mtcars$vs == 1 ~ \"Woww\", mtcars$mpg > 15 ~ \"QW\", mtcars$qsec > 18 ~ \"ooh lalal\", .sep = \";\", .default = NA ) #> [1] \"QW\" \"QW\" \"Woww;QW;ooh lalal\" #> [4] \"Woww;QW;ooh lalal\" \"QW\" \"Woww;QW;ooh lalal\" #> [7] NA \"Woww;QW;ooh lalal\" \"Woww;QW;ooh lalal\" #> [10] \"Woww;QW;ooh lalal\" \"Woww;QW;ooh lalal\" \"QW\" #> [13] \"QW\" \"QW\" NA #> [16] NA NA \"Woww;QW;ooh lalal\" #> [19] \"Woww;QW;ooh lalal\" \"Woww;QW;ooh lalal\" \"Woww;QW;ooh lalal\" #> [22] \"QW\" \"QW\" NA #> [25] \"QW\" \"Woww;QW;ooh lalal\" \"QW\" #> [28] \"Woww;QW\" \"QW\" \"QW\" #> [31] NA \"Woww;QW;ooh lalal\""},{"path":"https://olivroy.github.io/reuseme/reference/check_referenced_files.html","id":null,"dir":"Reference","previous_headings":"","what":"Check if files referenced in source files exist in a current dir — check_referenced_files","title":"Check if files referenced in source files exist in a current dir — check_referenced_files","text":"goes source files (.R/.qmd etc.), identifies data files (.csv, .xlsx) read written Search system files exist.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/check_referenced_files.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check if files referenced in source files exist in a current dir — check_referenced_files","text":"","code":"check_referenced_files(path = \".\", quiet = FALSE)"},{"path":"https://olivroy.github.io/reuseme/reference/check_referenced_files.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Check if files referenced in source files exist in a current dir — check_referenced_files","text":"path directory search quiet Whether print messages?","code":""},{"path":"https://olivroy.github.io/reuseme/reference/check_referenced_files.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check if files referenced in source files exist in a current dir — check_referenced_files","text":"logical","code":""},{"path":"https://olivroy.github.io/reuseme/reference/check_referenced_files.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Check if files referenced in source files exist in a current dir — check_referenced_files","text":"Still WIP, can add code false positive needed. find genuine referenced files, exclude different paths created fs::path() file.path() glue::glue() checked fs::file_exists(), file.exists() Deleted fs::file_delete(), unlink()","code":""},{"path":"https://olivroy.github.io/reuseme/reference/count_pct.html","id":null,"dir":"Reference","previous_headings":"","what":"Count observations by group and compute percentage — count_pct","title":"Count observations by group and compute percentage — count_pct","text":"count_pct() lets quickly count unique values one variables: df |> count_pct(, b) calculates percentage group afterwards","code":""},{"path":"https://olivroy.github.io/reuseme/reference/count_pct.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Count observations by group and compute percentage — count_pct","text":"","code":"count_pct( .data, ..., label = FALSE, accuracy = NULL, name = NULL, sort = FALSE )"},{"path":"https://olivroy.github.io/reuseme/reference/count_pct.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Count observations by group and compute percentage — count_pct","text":".data data frame, data frame extension (e.g. tibble), lazy data frame (e.g. dbplyr dtplyr). ... Variables group . label logical, TRUE, return vector character accuracy number round . Use (e.g.) 0.01 show 2 decimal places precision. NULL, default, uses heuristic ensure breaks minimum number digits needed show difference adjacent values. Applied rescaled data. name name new column output. omitted, default n. already column called n, use nn. column called n nn, 'll use nnn, , adding ns gets new name. sort TRUE, show largest groups top.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/count_pct.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Count observations by group and compute percentage — count_pct","text":"object type .data. count() add_count() group transiently, output groups input.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/count_pct.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Count observations by group and compute percentage — count_pct","text":"Wrapper function around dplyr::count()","code":""},{"path":[]},{"path":"https://olivroy.github.io/reuseme/reference/count_pct.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Count observations by group and compute percentage — count_pct","text":"","code":"count_pct(mtcars, cyl) #> cyl n percent #> 1 4 11 0.34375 #> 2 6 7 0.21875 #> 3 8 14 0.43750 mtcars |> dplyr::group_by(vs) |> count_pct(cyl) #> # A tibble: 5 × 4 #> # Groups: vs [2] #> vs cyl n percent #> #> 1 0 4 1 0.0556 #> 2 0 6 3 0.167 #> 3 0 8 14 0.778 #> 4 1 4 10 0.714 #> 5 1 6 4 0.286 mtcars |> dplyr::group_by(vs) |> count_pct(cyl, label = TRUE) #> # A tibble: 5 × 4 #> # Groups: vs [2] #> vs cyl n percent #> #> 1 0 4 1 5.6% #> 2 0 6 3 16.7% #> 3 0 8 14 77.8% #> 4 1 4 10 71.4% #> 5 1 6 4 28.6% mtcars |> dplyr::group_by(vs) |> count_pct(cyl, label = TRUE, accuracy = 0.1) #> # A tibble: 5 × 4 #> # Groups: vs [2] #> vs cyl n percent #> #> 1 0 4 1 5.6% #> 2 0 6 3 16.7% #> 3 0 8 14 77.8% #> 4 1 4 10 71.4% #> 5 1 6 4 28.6%"},{"path":"https://olivroy.github.io/reuseme/reference/eda-identity.html","id":null,"dir":"Reference","previous_headings":"","what":"Helpers that return the same value — eda-identity","title":"Helpers that return the same value — eda-identity","text":"share *_identity suffix, silent non-interactive sessions. handy create clickable hyperlinks modify current state analysis. inspired pillar::glimpse, tibble::view. Look original functions parameters.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/eda-identity.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Helpers that return the same value — eda-identity","text":"","code":"names_identity(x, nrows = NULL, extra_msg = NULL) count_identity( x, ..., sort = TRUE, name = NULL, nrows = NULL, extra_msg = NULL ) mutate_identity( x, ..., .keep = NULL, .before = NULL, nrows = NULL, extra_msg = NULL ) slice_identity( x, ..., .by = NULL, .preserve = FALSE, nrows = NULL, extra_msg = NULL ) slice_min_identity( x, order_by, ..., n, prop, by = NULL, with_ties = TRUE, na_rm = TRUE, nrows = NULL, extra_msg = NULL ) slice_max_identity( x, order_by, ..., n, prop, by = NULL, with_ties = TRUE, na_rm = TRUE, nrows = NULL, extra_msg = NULL ) arrange_identity(x, ..., .by_group = FALSE, nrows = NULL, extra_msg = NULL) distinct_identity(x, ..., .keep_all = FALSE, nrows = NULL, extra_msg = NULL) filter_identity(x, ..., .by = NULL, nrows = NULL, extra_msg = NULL) slice_sample_identity( x, ..., n, prop, by = NULL, weight_by = NULL, replace = FALSE, nrows = NULL, extra_msg = NULL ) filter_if_any_identity( x, ..., .by = NULL, .keep_new_var = FALSE, nrows = NULL, extra_msg = NULL ) slice_min_max_identity( x, order_by, ..., n, prop, by = NULL, with_ties = TRUE, na_rm = FALSE, each = TRUE, ascending = TRUE, nrows = NULL, extra_msg = NULL ) slice_group_sample_identity( x, group_var = NULL, n_groups = 1, nrows = NULL, extra_msg = NULL )"},{"path":"https://olivroy.github.io/reuseme/reference/eda-identity.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Helpers that return the same value — eda-identity","text":"x main object (data.frame, functions accept vector.) (aka .data dplyr functions, naming x throughout.) nrows Number rows print. extra_msg character vector observations print console, notes taken related transformation. name, sort, .keep_all, ., , n_groups, group_var, ..., n, prop, with_ties, order_by, .keep, ., , na_rm, weight_by, replace, .by_group, .keep_new_var, .preserve, ascending Check original functions.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/eda-identity.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Helpers that return the same value — eda-identity","text":"x, original input (invisibly) returned. (allowing *_identity() functions used pipeline) print extra_msg console interactive sessions.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/eda-identity.html","id":"use-cases-advantages","dir":"Reference","previous_headings":"","what":"Use cases / advantages","title":"Helpers that return the same value — eda-identity","text":"Like many reuseme functions, useful interactive sessions print result interactive sessions (quiet non-interactive.) Create runnable hyperlinks (August 2023, RStudio forbids runnable hyperlinks base functions, non-package functions. (.e. ::)) Use pipelines explore data Use rlang::is_interactive() base::interactive() easier control test options(rlang_interactive) Use original functions final results. count_identity() also prints percentages. slice_identity() can useful resolve many--many warnings dplyr join functions.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/eda-identity.html","id":"caution","dir":"Reference","previous_headings":"","what":"Caution","title":"Helpers that return the same value — eda-identity","text":"put end pipeline name first argument, avoid conflicts case column data named x. functions small tweaks mutate_identity() prints distinct values, uses .keep = \"used\", .= 0, unless specified improve display. count_identity() wrapper count_pct() (wrapper dplyr::count()), count_identity() may fail already variable named n. slice_min/max_identity() relocates target column beginning. filter_identity() prints short message rows returned.","code":""},{"path":[]},{"path":"https://olivroy.github.io/reuseme/reference/eda-identity.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Helpers that return the same value — eda-identity","text":"","code":"withr::local_options(rlang_interactive = TRUE) # Workflow to explore mtcars mtcars |> filter_identity(mpg > 21, extra_msg = c(\"Wow, these rows are very interesting.\")) |> count_identity( vs, extra_msg = c( \"Woo, there are 14 obs with vs = 1, 18 obs with vs = 0\", \"The split is 56%-43%\" ) ) |> dplyr::filter(disp > 150) # after all, I need only disp > 150 #> mpg cyl disp hp drat wt qsec vs am gear carb #> Mazda RX4 21.0 6 160.0 110 3.90 2.620 16.46 0 1 4 4 #> Mazda RX4 Wag 21.0 6 160.0 110 3.90 2.875 17.02 0 1 4 4 #> Hornet 4 Drive 21.4 6 258.0 110 3.08 3.215 19.44 1 0 3 1 #> Hornet Sportabout 18.7 8 360.0 175 3.15 3.440 17.02 0 0 3 2 #> Valiant 18.1 6 225.0 105 2.76 3.460 20.22 1 0 3 1 #> Duster 360 14.3 8 360.0 245 3.21 3.570 15.84 0 0 3 4 #> Merc 280 19.2 6 167.6 123 3.92 3.440 18.30 1 0 4 4 #> Merc 280C 17.8 6 167.6 123 3.92 3.440 18.90 1 0 4 4 #> Merc 450SE 16.4 8 275.8 180 3.07 4.070 17.40 0 0 3 3 #> Merc 450SL 17.3 8 275.8 180 3.07 3.730 17.60 0 0 3 3 #> Merc 450SLC 15.2 8 275.8 180 3.07 3.780 18.00 0 0 3 3 #> Cadillac Fleetwood 10.4 8 472.0 205 2.93 5.250 17.98 0 0 3 4 #> Lincoln Continental 10.4 8 460.0 215 3.00 5.424 17.82 0 0 3 4 #> Chrysler Imperial 14.7 8 440.0 230 3.23 5.345 17.42 0 0 3 4 #> Dodge Challenger 15.5 8 318.0 150 2.76 3.520 16.87 0 0 3 2 #> AMC Javelin 15.2 8 304.0 150 3.15 3.435 17.30 0 0 3 2 #> Camaro Z28 13.3 8 350.0 245 3.73 3.840 15.41 0 0 3 4 #> Pontiac Firebird 19.2 8 400.0 175 3.08 3.845 17.05 0 0 3 2 #> Ford Pantera L 15.8 8 351.0 264 4.22 3.170 14.50 0 1 5 4 #> Maserati Bora 15.0 8 301.0 335 3.54 3.570 14.60 0 1 5 8"},{"path":"https://olivroy.github.io/reuseme/reference/extract_cell_value.html","id":null,"dir":"Reference","previous_headings":"","what":"Elegant wrapper around filter and pull — extract_cell_value","title":"Elegant wrapper around filter and pull — extract_cell_value","text":"can useful trying extract value somewhere, one col represents unique id.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/extract_cell_value.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Elegant wrapper around filter and pull — extract_cell_value","text":"","code":"extract_cell_value( data, var, filter, name = NULL, length = NULL, unique = FALSE )"},{"path":"https://olivroy.github.io/reuseme/reference/extract_cell_value.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Elegant wrapper around filter and pull — extract_cell_value","text":"data data.frame var variable specified : literal variable name positive integer, giving position counting left negative integer, giving position counting right. default returns last column (assumption column created recently). argument taken expression supports quasiquotation (can unquote column names column locations). filter filter name variable name (default, look rownames), can quoted (safer). length fixed length check output unique logical. return unique values?","code":""},{"path":"https://olivroy.github.io/reuseme/reference/extract_cell_value.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Elegant wrapper around filter and pull — extract_cell_value","text":"(named) character vector (name specified)","code":""},{"path":"https://olivroy.github.io/reuseme/reference/extract_cell_value.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Elegant wrapper around filter and pull — extract_cell_value","text":"","code":"# extract the skin_color for C-3PO extract_cell_value( data = dplyr::starwars, var = skin_color, filter = name == \"C-3PO\", length = 1 # ensure the length will be 1. ) #> [1] \"gold\" # will return a named vector of mpg (as mtcars has rownames.) mtcars |> extract_cell_value( var = mpg, filter = vs == 0 ) #> Mazda RX4 Mazda RX4 Wag Hornet Sportabout Duster 360 #> 21.0 21.0 18.7 14.3 #> Merc 450SE Merc 450SL Merc 450SLC Cadillac Fleetwood #> 16.4 17.3 15.2 10.4 #> Lincoln Continental Chrysler Imperial Dodge Challenger AMC Javelin #> 10.4 14.7 15.5 15.2 #> Camaro Z28 Pontiac Firebird Porsche 914-2 Ford Pantera L #> 13.3 19.2 26.0 15.8 #> Ferrari Dino Maserati Bora #> 19.7 15.0 # Extract hair color for all people extract_cell_value( data = dplyr::starwars, var = skin_color, filter = TRUE, name = \"name\" # ensure it is a named vector that corresponds to their unique ID ) #> Luke Skywalker C-3PO R2-D2 #> \"fair\" \"gold\" \"white, blue\" #> Darth Vader Leia Organa Owen Lars #> \"white\" \"light\" \"light\" #> Beru Whitesun Lars R5-D4 Biggs Darklighter #> \"light\" \"white, red\" \"light\" #> Obi-Wan Kenobi Anakin Skywalker Wilhuff Tarkin #> \"fair\" \"fair\" \"fair\" #> Chewbacca Han Solo Greedo #> \"unknown\" \"fair\" \"green\" #> Jabba Desilijic Tiure Wedge Antilles Jek Tono Porkins #> \"green-tan, brown\" \"fair\" \"fair\" #> Yoda Palpatine Boba Fett #> \"green\" \"pale\" \"fair\" #> IG-88 Bossk Lando Calrissian #> \"metal\" \"green\" \"dark\" #> Lobot Ackbar Mon Mothma #> \"light\" \"brown mottle\" \"fair\" #> Arvel Crynyd Wicket Systri Warrick Nien Nunb #> \"fair\" \"brown\" \"grey\" #> Qui-Gon Jinn Nute Gunray Finis Valorum #> \"fair\" \"mottled green\" \"fair\" #> Padmé Amidala Jar Jar Binks Roos Tarpals #> \"light\" \"orange\" \"grey\" #> Rugor Nass Ric Olié Watto #> \"green\" \"fair\" \"blue, grey\" #> Sebulba Quarsh Panaka Shmi Skywalker #> \"grey, red\" \"dark\" \"fair\" #> Darth Maul Bib Fortuna Ayla Secura #> \"red\" \"pale\" \"blue\" #> Ratts Tyerel Dud Bolt Gasgano #> \"grey, blue\" \"blue, grey\" \"white, blue\" #> Ben Quadinaros Mace Windu Ki-Adi-Mundi #> \"grey, green, yellow\" \"dark\" \"pale\" #> Kit Fisto Eeth Koth Adi Gallia #> \"green\" \"brown\" \"dark\" #> Saesee Tiin Yarael Poof Plo Koon #> \"pale\" \"white\" \"orange\" #> Mas Amedda Gregar Typho Cordé #> \"blue\" \"dark\" \"light\" #> Cliegg Lars Poggle the Lesser Luminara Unduli #> \"fair\" \"green\" \"yellow\" #> Barriss Offee Dormé Dooku #> \"yellow\" \"light\" \"fair\" #> Bail Prestor Organa Jango Fett Zam Wesell #> \"tan\" \"tan\" \"fair, green, yellow\" #> Dexter Jettster Lama Su Taun We #> \"brown\" \"grey\" \"grey\" #> Jocasta Nu R4-P17 Wat Tambor #> \"fair\" \"silver, red\" \"green, grey\" #> San Hill Shaak Ti Grievous #> \"grey\" \"red, blue, white\" \"brown, white\" #> Tarfful Raymus Antilles Sly Moore #> \"brown\" \"light\" \"pale\" #> Tion Medon Finn Rey #> \"grey\" \"dark\" \"light\" #> Poe Dameron BB8 Captain Phasma #> \"light\" \"none\" \"none\""},{"path":"https://olivroy.github.io/reuseme/reference/filter_if_any.html","id":null,"dir":"Reference","previous_headings":"","what":"Keep rows that match one of the conditions — filter_if_any","title":"Keep rows that match one of the conditions — filter_if_any","text":"filter_if_any() function used subset data frame, retaining rows satisfy least one conditions. retained, row must produce value TRUE one conditions. Note condition evaluates NA row dropped, (hence function) unlike base subsetting [.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/filter_if_any.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Keep rows that match one of the conditions — filter_if_any","text":"","code":"filter_if_any(.data, ..., .by = NULL, .keep_new_var = FALSE)"},{"path":"https://olivroy.github.io/reuseme/reference/filter_if_any.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Keep rows that match one of the conditions — filter_if_any","text":".data data frame ... Expressions return logical value, defined terms variables .data. multiple expressions included, combined | operator. rows one conditions evaluate TRUE kept. .See dplyr::dplyr_by. .keep_new_var TRUE, remove newly created variables.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/filter_if_any.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Keep rows that match one of the conditions — filter_if_any","text":"object type .data. output following properties: Rows subset input, appear order. Columns modified (.keep_new_var = FALSE. Data frame attributes preserved.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/filter_if_any.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Keep rows that match one of the conditions — filter_if_any","text":"reason function simplify call like Basically, just shortcut mutate(.data, new_lgl_vars) + filter(if_any(new_lgl_vars)) + select(-new_lgl_vars). allows mutate_like syntax filter(if_any(...)). Caution: still work dplyr::across(), use regular filter(if_any()) syntax.","code":"# with dplyr::filter dat |> dplyr::filter(vs == 1 | is.na(vs)) data |> dplyr::mutate(cond1 = vs == 1, cond2 = is.na(vs)) |> dplyr::filter(dplyr::if_any(starts_with(\"cond\"))) dat |> filter_if_any(vs == 1, is.na(vs))"},{"path":"https://olivroy.github.io/reuseme/reference/filter_if_any.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Keep rows that match one of the conditions — filter_if_any","text":"","code":"mtcars |> dplyr::filter(cyl > 5 | mpg == 2) #> mpg cyl disp hp drat wt qsec vs am gear carb #> Mazda RX4 21.0 6 160.0 110 3.90 2.620 16.46 0 1 4 4 #> Mazda RX4 Wag 21.0 6 160.0 110 3.90 2.875 17.02 0 1 4 4 #> Hornet 4 Drive 21.4 6 258.0 110 3.08 3.215 19.44 1 0 3 1 #> Hornet Sportabout 18.7 8 360.0 175 3.15 3.440 17.02 0 0 3 2 #> Valiant 18.1 6 225.0 105 2.76 3.460 20.22 1 0 3 1 #> Duster 360 14.3 8 360.0 245 3.21 3.570 15.84 0 0 3 4 #> Merc 280 19.2 6 167.6 123 3.92 3.440 18.30 1 0 4 4 #> Merc 280C 17.8 6 167.6 123 3.92 3.440 18.90 1 0 4 4 #> Merc 450SE 16.4 8 275.8 180 3.07 4.070 17.40 0 0 3 3 #> Merc 450SL 17.3 8 275.8 180 3.07 3.730 17.60 0 0 3 3 #> Merc 450SLC 15.2 8 275.8 180 3.07 3.780 18.00 0 0 3 3 #> Cadillac Fleetwood 10.4 8 472.0 205 2.93 5.250 17.98 0 0 3 4 #> Lincoln Continental 10.4 8 460.0 215 3.00 5.424 17.82 0 0 3 4 #> Chrysler Imperial 14.7 8 440.0 230 3.23 5.345 17.42 0 0 3 4 #> Dodge Challenger 15.5 8 318.0 150 2.76 3.520 16.87 0 0 3 2 #> AMC Javelin 15.2 8 304.0 150 3.15 3.435 17.30 0 0 3 2 #> Camaro Z28 13.3 8 350.0 245 3.73 3.840 15.41 0 0 3 4 #> Pontiac Firebird 19.2 8 400.0 175 3.08 3.845 17.05 0 0 3 2 #> Ford Pantera L 15.8 8 351.0 264 4.22 3.170 14.50 0 1 5 4 #> Ferrari Dino 19.7 6 145.0 175 3.62 2.770 15.50 0 1 5 6 #> Maserati Bora 15.0 8 301.0 335 3.54 3.570 14.60 0 1 5 8 mtcars |> dplyr::filter(!(!cyl > 5 & !mpg == 2)) #> mpg cyl disp hp drat wt qsec vs am gear carb #> Mazda RX4 21.0 6 160.0 110 3.90 2.620 16.46 0 1 4 4 #> Mazda RX4 Wag 21.0 6 160.0 110 3.90 2.875 17.02 0 1 4 4 #> Hornet 4 Drive 21.4 6 258.0 110 3.08 3.215 19.44 1 0 3 1 #> Hornet Sportabout 18.7 8 360.0 175 3.15 3.440 17.02 0 0 3 2 #> Valiant 18.1 6 225.0 105 2.76 3.460 20.22 1 0 3 1 #> Duster 360 14.3 8 360.0 245 3.21 3.570 15.84 0 0 3 4 #> Merc 280 19.2 6 167.6 123 3.92 3.440 18.30 1 0 4 4 #> Merc 280C 17.8 6 167.6 123 3.92 3.440 18.90 1 0 4 4 #> Merc 450SE 16.4 8 275.8 180 3.07 4.070 17.40 0 0 3 3 #> Merc 450SL 17.3 8 275.8 180 3.07 3.730 17.60 0 0 3 3 #> Merc 450SLC 15.2 8 275.8 180 3.07 3.780 18.00 0 0 3 3 #> Cadillac Fleetwood 10.4 8 472.0 205 2.93 5.250 17.98 0 0 3 4 #> Lincoln Continental 10.4 8 460.0 215 3.00 5.424 17.82 0 0 3 4 #> Chrysler Imperial 14.7 8 440.0 230 3.23 5.345 17.42 0 0 3 4 #> Dodge Challenger 15.5 8 318.0 150 2.76 3.520 16.87 0 0 3 2 #> AMC Javelin 15.2 8 304.0 150 3.15 3.435 17.30 0 0 3 2 #> Camaro Z28 13.3 8 350.0 245 3.73 3.840 15.41 0 0 3 4 #> Pontiac Firebird 19.2 8 400.0 175 3.08 3.845 17.05 0 0 3 2 #> Ford Pantera L 15.8 8 351.0 264 4.22 3.170 14.50 0 1 5 4 #> Ferrari Dino 19.7 6 145.0 175 3.62 2.770 15.50 0 1 5 6 #> Maserati Bora 15.0 8 301.0 335 3.54 3.570 14.60 0 1 5 8 mtcars |> filter_if_any(cyl > 5, vs == 0) #> mpg cyl disp hp drat wt qsec vs am gear carb #> Mazda RX4 21.0 6 160.0 110 3.90 2.620 16.46 0 1 4 4 #> Mazda RX4 Wag 21.0 6 160.0 110 3.90 2.875 17.02 0 1 4 4 #> Hornet 4 Drive 21.4 6 258.0 110 3.08 3.215 19.44 1 0 3 1 #> Hornet Sportabout 18.7 8 360.0 175 3.15 3.440 17.02 0 0 3 2 #> Valiant 18.1 6 225.0 105 2.76 3.460 20.22 1 0 3 1 #> Duster 360 14.3 8 360.0 245 3.21 3.570 15.84 0 0 3 4 #> Merc 280 19.2 6 167.6 123 3.92 3.440 18.30 1 0 4 4 #> Merc 280C 17.8 6 167.6 123 3.92 3.440 18.90 1 0 4 4 #> Merc 450SE 16.4 8 275.8 180 3.07 4.070 17.40 0 0 3 3 #> Merc 450SL 17.3 8 275.8 180 3.07 3.730 17.60 0 0 3 3 #> Merc 450SLC 15.2 8 275.8 180 3.07 3.780 18.00 0 0 3 3 #> Cadillac Fleetwood 10.4 8 472.0 205 2.93 5.250 17.98 0 0 3 4 #> Lincoln Continental 10.4 8 460.0 215 3.00 5.424 17.82 0 0 3 4 #> Chrysler Imperial 14.7 8 440.0 230 3.23 5.345 17.42 0 0 3 4 #> Dodge Challenger 15.5 8 318.0 150 2.76 3.520 16.87 0 0 3 2 #> AMC Javelin 15.2 8 304.0 150 3.15 3.435 17.30 0 0 3 2 #> Camaro Z28 13.3 8 350.0 245 3.73 3.840 15.41 0 0 3 4 #> Pontiac Firebird 19.2 8 400.0 175 3.08 3.845 17.05 0 0 3 2 #> Porsche 914-2 26.0 4 120.3 91 4.43 2.140 16.70 0 1 5 2 #> Ford Pantera L 15.8 8 351.0 264 4.22 3.170 14.50 0 1 5 4 #> Ferrari Dino 19.7 6 145.0 175 3.62 2.770 15.50 0 1 5 6 #> Maserati Bora 15.0 8 301.0 335 3.54 3.570 14.60 0 1 5 8"},{"path":"https://olivroy.github.io/reuseme/reference/link_issue.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a cli link to a GitHub issue — link_issue","title":"Create a cli link to a GitHub issue — link_issue","text":"RStudio, links issues automatically recognized. function creates cli ansi links entries form rstudio/rstudio#1100","code":""},{"path":"https://olivroy.github.io/reuseme/reference/link_issue.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a cli link to a GitHub issue — link_issue","text":"","code":"link_issue(x)"},{"path":"https://olivroy.github.io/reuseme/reference/link_issue.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a cli link to a GitHub issue — link_issue","text":"x string, usually lines files contains issue numbers.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/link_issue.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a cli link to a GitHub issue — link_issue","text":"formatted linked issue GitHub issue","code":""},{"path":"https://olivroy.github.io/reuseme/reference/link_issue.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a cli link to a GitHub issue — link_issue","text":"Note: support without /","code":""},{"path":"https://olivroy.github.io/reuseme/reference/link_issue.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a cli link to a GitHub issue — link_issue","text":"","code":"link_issue(c(\"We really need rstudio/gt#1469 to be fixed.\")) |> cli::cli_bullets() #> We really need rstudio/gt#1469 () to #> be fixed."},{"path":"https://olivroy.github.io/reuseme/reference/mark_todo_as_complete.html","id":null,"dir":"Reference","previous_headings":"","what":"Remove a TODO/WORK/FIXME item from a file — mark_todo_as_complete","title":"Remove a TODO/WORK/FIXME item from a file — mark_todo_as_complete","text":"Function meant wrapped {.run} hyperlinks file_outline(). basically removes line file.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/mark_todo_as_complete.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Remove a TODO/WORK/FIXME item from a file — mark_todo_as_complete","text":"","code":"mark_todo_as_complete(line_id, file, regexp, rm_line = NULL)"},{"path":"https://olivroy.github.io/reuseme/reference/mark_todo_as_complete.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Remove a TODO/WORK/FIXME item from a file — mark_todo_as_complete","text":"line_id line number (single integer) file Path file regexp regexp assess file content changed. rm_line logical NULL remove full line file (TODO, FIXME items), else WORK, remove WORK tag remove tag (.e. TODO, WORK, FIXME)","code":""},{"path":"https://olivroy.github.io/reuseme/reference/mark_todo_as_complete.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Remove a TODO/WORK/FIXME item from a file — mark_todo_as_complete","text":"Writes file corrections, returns new line content invisibly.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/na_if2.html","id":null,"dir":"Reference","previous_headings":"","what":"Transform to NA any of the condition — na_if2","title":"Transform to NA any of the condition — na_if2","text":"function similar dplyr::na_if(), 2 differences. values y never recycled. two ways provide condition. values logical vector.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/na_if2.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Transform to NA any of the condition — na_if2","text":"","code":"na_if2(x, values, expr)"},{"path":"https://olivroy.github.io/reuseme/reference/na_if2.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Transform to NA any of the condition — na_if2","text":"x vector. values vector values. length values = 1, actually preferable use dplyr::na_if() clarity. expr logical vector length x","code":""},{"path":"https://olivroy.github.io/reuseme/reference/na_if2.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Transform to NA any of the condition — na_if2","text":"x NA values required.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/na_if2.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Transform to NA any of the condition — na_if2","text":"","code":"vec <- c(0, 1, 1, 2) vec2 <- c(\"Here\", \"not\", NA, \"Here\") # NA all 2s # You can actually use dplyr::na_if() in this case dplyr::na_if(vec, 2) #> [1] 0 1 1 NA # NA all 1 and 2 na_if2(vec, c(1, 2)) #> [1] 0 NA NA NA na_if2(vec, expr = vec2 == \"Here\") #> [1] NA 1 1 NA"},{"path":"https://olivroy.github.io/reuseme/reference/named-base.html","id":null,"dir":"Reference","previous_headings":"","what":"Helpers that can return a named vector — named-base","title":"Helpers that can return a named vector — named-base","text":"Base R keeps names various places, drops elsewhere functions use frequently, like max, unique","code":""},{"path":"https://olivroy.github.io/reuseme/reference/named-base.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Helpers that can return a named vector — named-base","text":"","code":"min_named(x, na.rm = FALSE, all_matches = FALSE) max_named(x, na.rm = FALSE, all_matches = FALSE) unique_named(x)"},{"path":"https://olivroy.github.io/reuseme/reference/named-base.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Helpers that can return a named vector — named-base","text":"x vector na.rm remove NA? all_matches FALSE (default), return first match, similar .min() / .max() TRUE, return named vector values corresponding max value.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/named-base.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Helpers that can return a named vector — named-base","text":"min/max_named(all_matches = FALSE), named vector length 1. Otherwise, named vector.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/named-base.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Helpers that can return a named vector — named-base","text":"","code":"max_named(c(\"this guy\" = 2, \"that guy\" = 3)) #> that guy #> 3 unique_named(c(\"this guy\" = 2, \"that guy\" = 3, \"this guy\" = 2)) #> this guy that guy #> 2 3 # returns the same as base R for unnamed input unique_named(c(1, 2, 3, 3)) #> [1] 1 2 3 # returns all values min_named(c(\"x\" = 1, \"y\" = 1, \"ww\" = 2), all_matches = FALSE) #> x #> 1 # TODO is usable with `extract_cell_value()`"},{"path":"https://olivroy.github.io/reuseme/reference/open_rs_doc.html","id":null,"dir":"Reference","previous_headings":"","what":"Open a Document in RStudio — open_rs_doc","title":"Open a Document in RStudio — open_rs_doc","text":"Wrapper around rstudioapi::documentOpen(), fs paths, consistency. file opened, clickable hyperlink displayed.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/open_rs_doc.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Open a Document in RStudio — open_rs_doc","text":"","code":"open_rs_doc(path, line = -1L, col = -1L, move_cursor = TRUE) active_rs_doc()"},{"path":"https://olivroy.github.io/reuseme/reference/open_rs_doc.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Open a Document in RStudio — open_rs_doc","text":"path path document. line line document navigate . col column document navigate . move_cursor Boolean; move cursor requested location opening document?","code":""},{"path":"https://olivroy.github.io/reuseme/reference/open_rs_doc.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Open a Document in RStudio — open_rs_doc","text":"Invisibly returns document id","code":""},{"path":"https://olivroy.github.io/reuseme/reference/open_rs_doc.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Open a Document in RStudio — open_rs_doc","text":"active_rs_doc() wrapper around rstudioapi::documentPath() handles unsaved files gracefully","code":""},{"path":"https://olivroy.github.io/reuseme/reference/open_rs_doc.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Open a Document in RStudio — open_rs_doc","text":"","code":"if (FALSE) { # open the fictious file.R at line 5 open_rs_doc(\"file.R\", line = 5) }"},{"path":"https://olivroy.github.io/reuseme/reference/outdated_pkgs.html","id":null,"dir":"Reference","previous_headings":"","what":"Looks for outdated packages — outdated_pkgs","title":"Looks for outdated packages — outdated_pkgs","text":"checks binaries, advantage notifying packages newly available CRAN, without binaries available. Installing packages source can longer, hence advantage waiting days binaries. takes advantage pak's capacities allow install packages Windows without restarting session.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/outdated_pkgs.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Looks for outdated packages — outdated_pkgs","text":"","code":"outdated_pkgs(type = c(\"binary\", \"source\"))"},{"path":"https://olivroy.github.io/reuseme/reference/outdated_pkgs.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Looks for outdated packages — outdated_pkgs","text":"type Type package look (\"binary\" \"source\")","code":""},{"path":"https://olivroy.github.io/reuseme/reference/outdated_pkgs.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Looks for outdated packages — outdated_pkgs","text":"list packages can updated, links news, pkgdown site.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/outdated_pkgs.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Looks for outdated packages — outdated_pkgs","text":"","code":"# \\donttest{ outdated_pkgs() #> Warning: Couldn't check for outdated packages. #> Can't connect to your default repository. #> Are you offline? # }"},{"path":"https://olivroy.github.io/reuseme/reference/outline.html","id":null,"dir":"Reference","previous_headings":"","what":"Print interactive outline of file sections — outline","title":"Print interactive outline of file sections — outline","text":"RStudio project, directories fail trying map unsaved file.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/outline.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Print interactive outline of file sections — outline","text":"","code":"file_outline( regex_outline = NULL, path = active_rs_doc(), work_only = TRUE, alpha = FALSE, dir_common = NULL, print_todo = TRUE, recent_only = FALSE, width = cli::console_width(), n_colors = NULL ) proj_outline( regex_outline = NULL, proj = proj_get2(), work_only = TRUE, dir_tree = FALSE, alpha = FALSE, recent_only = FALSE ) dir_outline( regex_outline = NULL, path = \".\", work_only = TRUE, dir_tree = FALSE, alpha = FALSE, recent_only = FALSE )"},{"path":"https://olivroy.github.io/reuseme/reference/outline.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Print interactive outline of file sections — outline","text":"regex_outline string regex search outline path, proj character vector file paths, project. Defaults active file, project directory. rstudioapi::documentPath() work_only TRUE, (default), show work items first. Set FALSE want see full outline. WORK combine regex_outline alpha Whether show alphabetical order dir_common (use ) print_todo include TODOs file outline? FALSE, print less verbose output sections. recent_only Show outline recent files width Width (internal) n_colors Number colours (Internal) dir_tree TRUE, print fs::dir_tree() non-R files directory","code":""},{"path":"https://olivroy.github.io/reuseme/reference/outline.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Print interactive outline of file sections — outline","text":"outline_report object contains information. Inherits tbl_df. symbol show recently modified files.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/outline.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Print interactive outline of file sections — outline","text":"work_only set TRUE, function return outline # WORK comment path. work_only = TRUE effect regex_outline. functions default file_outline() prints outline active document RStudio proj_outline() prints outline active project RStudio dir_outline() prints outline active working directory default proj_* dir_ call file_outline. parser opinioneted robust based regexps. better file parser, explore options, like lightparser, {roxygen2} show TODO items offer link mark complete","code":""},{"path":"https://olivroy.github.io/reuseme/reference/outline.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Print interactive outline of file sections — outline","text":"","code":"file <- fs::path_package(\"reuseme\", \"example-file\", \"outline-script.R\") file_outline(path = file) #> #> ── `example-file/outline-script.R` 🦐 Example for `file_outline()` #> `i` Load packages #> `i` Wrangle + visualize data #> `i` A great title #> `i` TODO improve this Viz!- `Done✔?` # Remove TODO file_outline(path = file, print_todo = FALSE, alpha = TRUE) #> #> ── `example-file/outline-script.R` 🦐 Example for `file_outline()` #> `i` Example for `file_outline()` #> `i` Load packages #> `i` Wrangle + visualize data # interact with data frame file_outline(path = file) |> dplyr::as_tibble() #> # A tibble: 5 × 31 #> file line_id content file_ext is_md is_test_file is_cli_info is_doc_title #> #> 1 /home/ru… 1 \"# Exa… R FALSE FALSE FALSE FALSE #> 2 /home/ru… 2 \"# Loa… R FALSE FALSE FALSE FALSE #> 3 /home/ru… 5 \"# Wra… R FALSE FALSE FALSE FALSE #> 4 /home/ru… 10 \" t… R FALSE FALSE FALSE FALSE #> 5 /home/ru… 12 \"# TOD… R FALSE FALSE FALSE FALSE #> # ℹ 23 more variables: is_chunk_cap , is_chunk_cap_next , #> # is_test_name , is_section_title , is_section_title_source , #> # is_tab_or_plot_title , is_a_comment_or_code , #> # is_todo_fixme , before_and_after_empty , n_leading_hash , #> # is_second_level_heading_or_more , is_cross_ref , #> # outline_el , is_subtitle , importance , link , #> # file_path , is_saved_doc , text_in_link , style_fun , … if (FALSE) { # interactive() # These all work on the active file / project or directory. file_outline() proj_outline() dir_outline() # Like proj_switch(), proj_outline() accepts a project }"},{"path":"https://olivroy.github.io/reuseme/reference/proj-reuseme.html","id":null,"dir":"Reference","previous_headings":"","what":"Interact with different RStudio projects — proj-reuseme","title":"Interact with different RStudio projects — proj-reuseme","text":"package offers many ways interact different local RStudio projects.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/proj-reuseme.html","id":"setup","dir":"Reference","previous_headings":"","what":"Setup","title":"Interact with different RStudio projects — proj-reuseme","text":"take advantage functionality, first set options(reuseme.reposdir) .Rprofile file. Access usethis::edit_r_profile(). recommend add following. works better store RStudio projects common directories. Inspired usethis options","code":"if (interactive()) { options(reuseme.reposdir = c(\"~/rrr/\", \"~/packages\", \"~/rrr-work/\")) }"},{"path":"https://olivroy.github.io/reuseme/reference/proj-reuseme.html","id":"capabilities-","dir":"Reference","previous_headings":"","what":"Capabilities.","title":"Interact with different RStudio projects — proj-reuseme","text":"Assumes project named \"learning\" project outline Add TODO item learning project Get file outline file.R \"learning\" Move new project session lot features already present RStudio usethis. However, managing many projects, recent projects list can difficult handle. Passing full project name usethis::proj_activate() long.","code":"proj_outline(proj = \"learning) use_todo(\"learning::Learn this\") proj_file(\"file\", \"learning\") proj_switch(\"learning\")"},{"path":[]},{"path":"https://olivroy.github.io/reuseme/reference/proj_file.html","id":null,"dir":"Reference","previous_headings":"","what":"Active a file at location — proj_file","title":"Active a file at location — proj_file","text":"Active file location","code":""},{"path":"https://olivroy.github.io/reuseme/reference/proj_file.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Active a file at location — proj_file","text":"","code":"proj_file(file = NULL, proj = NULL, regex_outline = NULL)"},{"path":"https://olivroy.github.io/reuseme/reference/proj_file.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Active a file at location — proj_file","text":"file filename regexp file inside proj proj project path file proj_list() regex_outline regular expression look ","code":""},{"path":"https://olivroy.github.io/reuseme/reference/proj_file.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Active a file at location — proj_file","text":"file outline multiple matches found","code":""},{"path":[]},{"path":"https://olivroy.github.io/reuseme/reference/proj_file.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Active a file at location — proj_file","text":"","code":"try(proj_file(\"A non-existent file\")) #> Error in proj_file(\"A non-existent file\") : #> No match found for \"A non-existent file\" in #> /home/runner/work/reuseme/reuseme"},{"path":"https://olivroy.github.io/reuseme/reference/proj_list.html","id":null,"dir":"Reference","previous_headings":"","what":"Returns a named project list options — proj_list","title":"Returns a named project list options — proj_list","text":"peeks options(reuseme.reposdir) find projects.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/proj_list.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Returns a named project list options — proj_list","text":"","code":"proj_list(dirs = getOption(\"reuseme.reposdir\"))"},{"path":"https://olivroy.github.io/reuseme/reference/proj_list.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Returns a named project list options — proj_list","text":"dirs directories want list projects.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/proj_list.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Returns a named project list options — proj_list","text":"named character vector project name ","code":""},{"path":[]},{"path":"https://olivroy.github.io/reuseme/reference/proj_switch.html","id":null,"dir":"Reference","previous_headings":"","what":"Opens a RStudio project in a new session — proj_switch","title":"Opens a RStudio project in a new session — proj_switch","text":"specified, generate hyperlinks call usethis::proj_activate(). proj_switch() looks options(reuseme.reposdir).","code":""},{"path":"https://olivroy.github.io/reuseme/reference/proj_switch.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Opens a RStudio project in a new session — proj_switch","text":"","code":"proj_switch(proj = NULL, new_session = TRUE)"},{"path":"https://olivroy.github.io/reuseme/reference/proj_switch.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Opens a RStudio project in a new session — proj_switch","text":"proj name project located default locations NULL new_session open new session?","code":""},{"path":"https://olivroy.github.io/reuseme/reference/proj_switch.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Opens a RStudio project in a new session — proj_switch","text":"Single logical value indicating current session modified.","code":""},{"path":[]},{"path":"https://olivroy.github.io/reuseme/reference/quarto_help.html","id":null,"dir":"Reference","previous_headings":"","what":"Show links to Quarto documentation of interest — quarto_help","title":"Show links to Quarto documentation of interest — quarto_help","text":"opinionated links need access periodically. Easily accessible R console.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/quarto_help.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Show links to Quarto documentation of interest — quarto_help","text":"","code":"quarto_help(subject = NULL)"},{"path":"https://olivroy.github.io/reuseme/reference/quarto_help.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Show links to Quarto documentation of interest — quarto_help","text":"subject character vector (optional)","code":""},{"path":"https://olivroy.github.io/reuseme/reference/quarto_help.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Show links to Quarto documentation of interest — quarto_help","text":"possible links help invisibly","code":""},{"path":"https://olivroy.github.io/reuseme/reference/quarto_help.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Show links to Quarto documentation of interest — quarto_help","text":"","code":"gt_help <- quarto_help() |> tibble::enframe() |> gt::gt() |> gt::fmt_url(value) # \\dontshow{ gt_help |> gt::as_raw_html() #>
#> #> #> #> #> #>
name<\/th> #> value<\/th> #> <\/tr> #> <\/thead> #>
dashboard<\/td> #> https://quarto.org/docs/dashboards/data-display.html<\/a><\/span><\/td><\/tr> #>
manuscript<\/td> #> https://quarto.org/docs/manuscripts/authoring/rstudio.html<\/a><\/span><\/td><\/tr> #>
revealjs<\/td> #> https://quarto.org/docs/presentations/revealjs/<\/a><\/span><\/td><\/tr> #>
blog<\/td> #> https://quarto.org/docs/websites/website-blog.html<\/a><\/span><\/td><\/tr> #>
theme<\/td> #> https://quarto.org/docs/dashboards/theming.html#theme-options<\/a><\/span><\/td><\/tr> #>
param<\/td> #> https://quarto.org/docs/computations/parameters.html#knitr<\/a><\/span><\/td><\/tr> #>
quartopub<\/td> #> https://quarto.org/docs/publishing/quarto-pub.html<\/a><\/span><\/td><\/tr> #>
gh-actions<\/td> #> https://quarto.org/docs/publishing/github-pages.html<\/a><\/span><\/td><\/tr> #>
netlify<\/td> #> https://quarto.org/docs/publishing/netlify.html<\/a><\/span><\/td><\/tr> #>
gallery<\/td> #> https://quarto.org/docs/gallery/<\/a><\/span><\/td><\/tr> #>
news<\/td> #> https://quarto.org/docs/download/<\/a><\/span><\/td><\/tr> #>
shortcode<\/td> #> https://quarto.org/docs/extensions/shortcodes.html<\/a><\/span><\/td><\/tr> #> <\/tbody> #> #> #> <\/table> #> <\/div> # }"},{"path":"https://olivroy.github.io/reuseme/reference/rename_files2.html","id":null,"dir":"Reference","previous_headings":"","what":"Rename an output or a data file and watch for references — rename_files2","title":"Rename an output or a data file and watch for references — rename_files2","text":"function can improve workflow. inspired usethis::rename_files(), scope oriented towards analysis script.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/rename_files2.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Rename an output or a data file and watch for references — rename_files2","text":"","code":"rename_files2( old, new, warn_conflicts = c(\"default\", \"all\", \"exact\", \"none\"), overwrite = FALSE, action = c(\"rename\", \"test\"), force = deprecated() )"},{"path":"https://olivroy.github.io/reuseme/reference/rename_files2.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Rename an output or a data file and watch for references — rename_files2","text":"old, new Old new file names (without extensions). warn_conflicts One \"default\": check thoroughly depending situation. moving directory, \"\" otherwise. \"\" (larger scope: old = \"data/-streets.csv|my_streets\" check objects named my_streets, files like -streets.R, etc.), \"exact\" search \"data/-streets.csv\" documents \"none\" search references documents rename. overwrite whether overwrite new already exists. careful. action One \"rename\" \"test\" force Use warn_conflicts instead force = TRUE","code":""},{"path":"https://olivroy.github.io/reuseme/reference/rename_files2.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Rename an output or a data file and watch for references — rename_files2","text":"new renaming succeeded. Mostly called side-effects","code":""},{"path":"https://olivroy.github.io/reuseme/reference/rename_files2.html","id":"use-case","dir":"Reference","previous_headings":"","what":"Use case","title":"Rename an output or a data file and watch for references — rename_files2","text":"say analysis work certain subject. want rename figure clarity. example, input file named data/-streets.csv now want rename rename_files2() , renames files. Look potential name conflict Look data frame name conflicts Sends information clipboard work well tend name objects using snake case naming objects snake case kebab-case. philosophy inform manual steps required actually performing file renaming. way less strict us","code":""},{"path":"https://olivroy.github.io/reuseme/reference/reuseme-package.html","id":null,"dir":"Reference","previous_headings":"","what":"reuseme: Collections of Utility Functions to Work Across Projects — reuseme-package","title":"reuseme: Collections of Utility Functions to Work Across Projects — reuseme-package","text":"Allows browse current projects, rename files safely, add screenshots project Windows. also personal library contains wrapper around common functions, dplyr readxl. takes advantage cli hyperlinks. Finally, provides custom print method tibbles, inspired janitor, readr.","code":""},{"path":[]},{"path":"https://olivroy.github.io/reuseme/reference/reuseme-package.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"reuseme: Collections of Utility Functions to Work Across Projects — reuseme-package","text":"Maintainer: Olivier Roy olivierroy71@hotmail.com","code":""},{"path":"https://olivroy.github.io/reuseme/reference/screenshot.html","id":null,"dir":"Reference","previous_headings":"","what":"Save the current image in clipboard to png in your active directory — screenshot","title":"Save the current image in clipboard to png in your active directory — screenshot","text":"screenshot saved .png directory following rules regular RStudio project (Quarto book), saved images/ directory package project, saved man/figures directory Quarto Blog project, save current post's folder. can always override defaults setting dir using shortcut Win + Shift + S, can call function!","code":""},{"path":"https://olivroy.github.io/reuseme/reference/screenshot.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Save the current image in clipboard to png in your active directory — screenshot","text":"","code":"screenshot(file = NULL, proj = proj_get(), dir = NULL)"},{"path":"https://olivroy.github.io/reuseme/reference/screenshot.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Save the current image in clipboard to png in your active directory — screenshot","text":"file file name, ideally - (kebab-case). (extension ignored) (optional, default image.png) proj project name dir directory (optional), override directory rules mentioned description. inside proj.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/screenshot.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Save the current image in clipboard to png in your active directory — screenshot","text":"full image path, invisibly.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/screenshot.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Save the current image in clipboard to png in your active directory — screenshot","text":"file name supplied, file named image0*.png created. function prompts rename file expressive name. continue numbering file named image exists. Still validate works macOS, clear whether image goes clipboard default maximum number images folder 99. (padding 2), enough. able overwrite screenshot generic name, named one possible may require retake screenshot.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/screenshot.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Save the current image in clipboard to png in your active directory — screenshot","text":"","code":"if (FALSE) { # Add an image to the clipboard # Run the following screenshot(file = \"my-new-image\") }"},{"path":"https://olivroy.github.io/reuseme/reference/slice_group_sample.html","id":null,"dir":"Reference","previous_headings":"","what":"Explore all rows in a random group — slice_group_sample","title":"Explore all rows in a random group — slice_group_sample","text":"Compared slice_sample() slice_group_sample return rows corresponding group.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/slice_group_sample.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Explore all rows in a random group — slice_group_sample","text":"","code":"slice_group_sample(data, group_var = NULL, n_groups = 1)"},{"path":"https://olivroy.github.io/reuseme/reference/slice_group_sample.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Explore all rows in a random group — slice_group_sample","text":"data data.frame group_var data grouped, ignored. n_groups Number groups sample. (passed sample(size = n_groups))","code":""},{"path":"https://olivroy.github.io/reuseme/reference/slice_group_sample.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Explore all rows in a random group — slice_group_sample","text":"data frame sample group.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/slice_group_sample.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Explore all rows in a random group — slice_group_sample","text":"","code":"set.seed(10) slice_group_sample(mtcars, group_var = vs) #> # A tibble: 18 × 11 #> mpg cyl disp hp drat wt qsec vs am gear carb #> #> 1 21 6 160 110 3.9 2.62 16.5 0 1 4 4 #> 2 21 6 160 110 3.9 2.88 17.0 0 1 4 4 #> 3 18.7 8 360 175 3.15 3.44 17.0 0 0 3 2 #> 4 14.3 8 360 245 3.21 3.57 15.8 0 0 3 4 #> 5 16.4 8 276. 180 3.07 4.07 17.4 0 0 3 3 #> 6 17.3 8 276. 180 3.07 3.73 17.6 0 0 3 3 #> 7 15.2 8 276. 180 3.07 3.78 18 0 0 3 3 #> 8 10.4 8 472 205 2.93 5.25 18.0 0 0 3 4 #> 9 10.4 8 460 215 3 5.42 17.8 0 0 3 4 #> 10 14.7 8 440 230 3.23 5.34 17.4 0 0 3 4 #> 11 15.5 8 318 150 2.76 3.52 16.9 0 0 3 2 #> 12 15.2 8 304 150 3.15 3.44 17.3 0 0 3 2 #> 13 13.3 8 350 245 3.73 3.84 15.4 0 0 3 4 #> 14 19.2 8 400 175 3.08 3.84 17.0 0 0 3 2 #> 15 26 4 120. 91 4.43 2.14 16.7 0 1 5 2 #> 16 15.8 8 351 264 4.22 3.17 14.5 0 1 5 4 #> 17 19.7 6 145 175 3.62 2.77 15.5 0 1 5 6 #> 18 15 8 301 335 3.54 3.57 14.6 0 1 5 8 mtcars |> dplyr::group_by(vs) |> slice_group_sample() #> # A tibble: 18 × 11 #> # Groups: vs [1] #> mpg cyl disp hp drat wt qsec vs am gear carb #> #> 1 21 6 160 110 3.9 2.62 16.5 0 1 4 4 #> 2 21 6 160 110 3.9 2.88 17.0 0 1 4 4 #> 3 18.7 8 360 175 3.15 3.44 17.0 0 0 3 2 #> 4 14.3 8 360 245 3.21 3.57 15.8 0 0 3 4 #> 5 16.4 8 276. 180 3.07 4.07 17.4 0 0 3 3 #> 6 17.3 8 276. 180 3.07 3.73 17.6 0 0 3 3 #> 7 15.2 8 276. 180 3.07 3.78 18 0 0 3 3 #> 8 10.4 8 472 205 2.93 5.25 18.0 0 0 3 4 #> 9 10.4 8 460 215 3 5.42 17.8 0 0 3 4 #> 10 14.7 8 440 230 3.23 5.34 17.4 0 0 3 4 #> 11 15.5 8 318 150 2.76 3.52 16.9 0 0 3 2 #> 12 15.2 8 304 150 3.15 3.44 17.3 0 0 3 2 #> 13 13.3 8 350 245 3.73 3.84 15.4 0 0 3 4 #> 14 19.2 8 400 175 3.08 3.84 17.0 0 0 3 2 #> 15 26 4 120. 91 4.43 2.14 16.7 0 1 5 2 #> 16 15.8 8 351 264 4.22 3.17 14.5 0 1 5 4 #> 17 19.7 6 145 175 3.62 2.77 15.5 0 1 5 6 #> 18 15 8 301 335 3.54 3.57 14.6 0 1 5 8"},{"path":"https://olivroy.github.io/reuseme/reference/slice_min_max.html","id":null,"dir":"Reference","previous_headings":"","what":"Subset rows using their positions — slice_min_max","title":"Subset rows using their positions — slice_min_max","text":"wrapper around dplyr::bind_rows(), dplyr::slice_min(), dplyr::slice_max()","code":""},{"path":"https://olivroy.github.io/reuseme/reference/slice_min_max.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Subset rows using their positions — slice_min_max","text":"","code":"slice_min_max( .data, order_by, ..., n, prop, by = NULL, with_ties = TRUE, na_rm = FALSE, each = TRUE, ascending = TRUE )"},{"path":"https://olivroy.github.io/reuseme/reference/slice_min_max.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Subset rows using their positions — slice_min_max","text":".data data frame, data frame extension (e.g. tibble), lazy data frame (e.g. dbplyr dtplyr). See Methods, , details. order_by Variable function variables order . order multiple variables, wrap data frame tibble. ... Arguments passed methods. n, prop Provide either n, number rows, prop, proportion rows select. neither supplied, n = 1 used. n greater number rows group (prop > 1), result silently truncated group size. prop rounded towards zero generate integer number rows. negative value n prop subtracted group size. example, n = -2 group 5 rows select 5 - 2 = 3 rows; prop = -0.25 8 rows select 8 * (1 - 0.25) = 6 rows. Optionally, selection columns group just operation, functioning alternative group_by(). details examples, see ?dplyr_by. with_ties ties kept together? default, TRUE, may return rows request. Use FALSE ignore ties, return first n rows. na_rm missing values order_by removed result? FALSE, NA values sorted end (like arrange()), included insufficient non-missing values reach n/prop. FALSE, n prop passed dplyr::slice_min() dplyr::slice_max() divided 2. (use ceiling() n ) ascending Return output ascending order. (min top)","code":""},{"path":"https://olivroy.github.io/reuseme/reference/slice_min_max.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Subset rows using their positions — slice_min_max","text":"object type .data. output following properties: row may appear 0, 1, many times output. minmax column added show min, max. Groups modified. Data frame attributes preserved.","code":""},{"path":[]},{"path":"https://olivroy.github.io/reuseme/reference/slice_min_max.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Subset rows using their positions — slice_min_max","text":"","code":"# in the presence of ties. mtcars |> dplyr::slice_min(cyl, n = 1) #> mpg cyl disp hp drat wt qsec vs am gear carb #> Datsun 710 22.8 4 108.0 93 3.85 2.320 18.61 1 1 4 1 #> Merc 240D 24.4 4 146.7 62 3.69 3.190 20.00 1 0 4 2 #> Merc 230 22.8 4 140.8 95 3.92 3.150 22.90 1 0 4 2 #> Fiat 128 32.4 4 78.7 66 4.08 2.200 19.47 1 1 4 1 #> Honda Civic 30.4 4 75.7 52 4.93 1.615 18.52 1 1 4 2 #> Toyota Corolla 33.9 4 71.1 65 4.22 1.835 19.90 1 1 4 1 #> Toyota Corona 21.5 4 120.1 97 3.70 2.465 20.01 1 0 3 1 #> Fiat X1-9 27.3 4 79.0 66 4.08 1.935 18.90 1 1 4 1 #> Porsche 914-2 26.0 4 120.3 91 4.43 2.140 16.70 0 1 5 2 #> Lotus Europa 30.4 4 95.1 113 3.77 1.513 16.90 1 1 5 2 #> Volvo 142E 21.4 4 121.0 109 4.11 2.780 18.60 1 1 4 2 # Use with_ties = FALSE to return exactly n matches mtcars |> dplyr::slice_min(cyl, n = 1, with_ties = FALSE) #> mpg cyl disp hp drat wt qsec vs am gear carb #> Datsun 710 22.8 4 108 93 3.85 2.32 18.61 1 1 4 1 # Use each = FALSE to have n divided in each place mtcars |> slice_min_max(cyl, n = 2) #> minmax mpg cyl disp hp drat wt qsec vs am gear carb #> Datsun 710 min 22.8 4 108.0 93 3.85 2.320 18.61 1 1 4 1 #> Merc 240D min 24.4 4 146.7 62 3.69 3.190 20.00 1 0 4 2 #> Merc 230 min 22.8 4 140.8 95 3.92 3.150 22.90 1 0 4 2 #> Fiat 128 min 32.4 4 78.7 66 4.08 2.200 19.47 1 1 4 1 #> Honda Civic min 30.4 4 75.7 52 4.93 1.615 18.52 1 1 4 2 #> Toyota Corolla min 33.9 4 71.1 65 4.22 1.835 19.90 1 1 4 1 #> Toyota Corona min 21.5 4 120.1 97 3.70 2.465 20.01 1 0 3 1 #> Fiat X1-9 min 27.3 4 79.0 66 4.08 1.935 18.90 1 1 4 1 #> Porsche 914-2 min 26.0 4 120.3 91 4.43 2.140 16.70 0 1 5 2 #> Lotus Europa min 30.4 4 95.1 113 3.77 1.513 16.90 1 1 5 2 #> Volvo 142E min 21.4 4 121.0 109 4.11 2.780 18.60 1 1 4 2 #> Hornet Sportabout max 18.7 8 360.0 175 3.15 3.440 17.02 0 0 3 2 #> Duster 360 max 14.3 8 360.0 245 3.21 3.570 15.84 0 0 3 4 #> Merc 450SE max 16.4 8 275.8 180 3.07 4.070 17.40 0 0 3 3 #> Merc 450SL max 17.3 8 275.8 180 3.07 3.730 17.60 0 0 3 3 #> Merc 450SLC max 15.2 8 275.8 180 3.07 3.780 18.00 0 0 3 3 #> Cadillac Fleetwood max 10.4 8 472.0 205 2.93 5.250 17.98 0 0 3 4 #> Lincoln Continental max 10.4 8 460.0 215 3.00 5.424 17.82 0 0 3 4 #> Chrysler Imperial max 14.7 8 440.0 230 3.23 5.345 17.42 0 0 3 4 #> Dodge Challenger max 15.5 8 318.0 150 2.76 3.520 16.87 0 0 3 2 #> AMC Javelin max 15.2 8 304.0 150 3.15 3.435 17.30 0 0 3 2 #> Camaro Z28 max 13.3 8 350.0 245 3.73 3.840 15.41 0 0 3 4 #> Pontiac Firebird max 19.2 8 400.0 175 3.08 3.845 17.05 0 0 3 2 #> Ford Pantera L max 15.8 8 351.0 264 4.22 3.170 14.50 0 1 5 4 #> Maserati Bora max 15.0 8 301.0 335 3.54 3.570 14.60 0 1 5 8 # Using each = TRUE (to retun n = 2, for min, n = 2 for max) mtcars |> slice_min_max(cyl, each = TRUE, n = 2) #> minmax mpg cyl disp hp drat wt qsec vs am gear carb #> Datsun 710 min 22.8 4 108.0 93 3.85 2.320 18.61 1 1 4 1 #> Merc 240D min 24.4 4 146.7 62 3.69 3.190 20.00 1 0 4 2 #> Merc 230 min 22.8 4 140.8 95 3.92 3.150 22.90 1 0 4 2 #> Fiat 128 min 32.4 4 78.7 66 4.08 2.200 19.47 1 1 4 1 #> Honda Civic min 30.4 4 75.7 52 4.93 1.615 18.52 1 1 4 2 #> Toyota Corolla min 33.9 4 71.1 65 4.22 1.835 19.90 1 1 4 1 #> Toyota Corona min 21.5 4 120.1 97 3.70 2.465 20.01 1 0 3 1 #> Fiat X1-9 min 27.3 4 79.0 66 4.08 1.935 18.90 1 1 4 1 #> Porsche 914-2 min 26.0 4 120.3 91 4.43 2.140 16.70 0 1 5 2 #> Lotus Europa min 30.4 4 95.1 113 3.77 1.513 16.90 1 1 5 2 #> Volvo 142E min 21.4 4 121.0 109 4.11 2.780 18.60 1 1 4 2 #> Hornet Sportabout max 18.7 8 360.0 175 3.15 3.440 17.02 0 0 3 2 #> Duster 360 max 14.3 8 360.0 245 3.21 3.570 15.84 0 0 3 4 #> Merc 450SE max 16.4 8 275.8 180 3.07 4.070 17.40 0 0 3 3 #> Merc 450SL max 17.3 8 275.8 180 3.07 3.730 17.60 0 0 3 3 #> Merc 450SLC max 15.2 8 275.8 180 3.07 3.780 18.00 0 0 3 3 #> Cadillac Fleetwood max 10.4 8 472.0 205 2.93 5.250 17.98 0 0 3 4 #> Lincoln Continental max 10.4 8 460.0 215 3.00 5.424 17.82 0 0 3 4 #> Chrysler Imperial max 14.7 8 440.0 230 3.23 5.345 17.42 0 0 3 4 #> Dodge Challenger max 15.5 8 318.0 150 2.76 3.520 16.87 0 0 3 2 #> AMC Javelin max 15.2 8 304.0 150 3.15 3.435 17.30 0 0 3 2 #> Camaro Z28 max 13.3 8 350.0 245 3.73 3.840 15.41 0 0 3 4 #> Pontiac Firebird max 19.2 8 400.0 175 3.08 3.845 17.05 0 0 3 2 #> Ford Pantera L max 15.8 8 351.0 264 4.22 3.170 14.50 0 1 5 4 #> Maserati Bora max 15.0 8 301.0 335 3.54 3.570 14.60 0 1 5 8"},{"path":"https://olivroy.github.io/reuseme/reference/solve_file_name_conflict.html","id":null,"dir":"Reference","previous_headings":"","what":"Check if outdated or non-existent file is. — solve_file_name_conflict","title":"Check if outdated or non-existent file is. — solve_file_name_conflict","text":"quiet = FALSE (default) give hint file referenced.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/solve_file_name_conflict.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check if outdated or non-existent file is. — solve_file_name_conflict","text":"","code":"solve_file_name_conflict( files, regex, dir = \".\", extra_msg = NULL, quiet = FALSE, what = NULL )"},{"path":"https://olivroy.github.io/reuseme/reference/solve_file_name_conflict.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Check if outdated or non-existent file is. — solve_file_name_conflict","text":"files files search regex regex related file name search dir directory operate extra_msg Extra message pass quiet logical, informs occurrences found. (Default, FALSE) file conflicts talking ","code":""},{"path":"https://olivroy.github.io/reuseme/reference/solve_file_name_conflict.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check if outdated or non-existent file is. — solve_file_name_conflict","text":"Mostly called side-effects, return number matches (0 referenced files problmatic)","code":""},{"path":"https://olivroy.github.io/reuseme/reference/summarise_with_total.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute a summary for one group with the total included. — summarise_with_total","title":"Compute a summary for one group with the total included. — summarise_with_total","text":"function useful create end tables, apply formula group overall. can specify personalized Total value .label argument. use output summarise_with_total() tidyr::pivot_wider(), write data spreadsheet, gt::gt() . try computing afterwards. can also used plotting Changes .variable factor.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/summarise_with_total.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute a summary for one group with the total included. — summarise_with_total","text":"","code":"summarise_with_total(.data, ..., .by = NULL, .label = \"Total\", .first = TRUE)"},{"path":"https://olivroy.github.io/reuseme/reference/summarise_with_total.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute a summary for one group with the total included. — summarise_with_total","text":".data data frame, data frame extension (e.g. tibble), lazy data frame (e.g. dbplyr dtplyr). See Methods, , details. ... Name-value pairs summary functions. name name variable result. value can : vector length 1, e.g. min(x), n(), sum(.na(y)). data frame, add multiple columns single expression. Returning values size 0 >1 deprecated 1.1.0. Please use reframe() instead. . Optionally, selection columns group just operation, functioning alternative group_by(). details examples, see ?dplyr_by. .label Label total value .first total top","code":""},{"path":"https://olivroy.github.io/reuseme/reference/summarise_with_total.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute a summary for one group with the total included. — summarise_with_total","text":"ungrouped data frame total included first last row.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/summarise_with_total.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Compute a summary for one group with the total included. — summarise_with_total","text":"","code":"# works with `.by` mtcars |> summarise_with_total( x = mean(mpg), .by = vs, .label = \"All vs\" ) #> vs x #> 1 All vs 20.09062 #> 2 0 16.61667 #> 3 1 24.55714 # works with `group_by()` mtcars |> dplyr::group_by(vs) |> summarise_with_total( x = mean(mpg), .label = \"All vs\" ) #> # A tibble: 3 × 2 #> vs x #> #> 1 All vs 20.1 #> 2 0 16.6 #> 3 1 24.6"},{"path":"https://olivroy.github.io/reuseme/reference/use_todo.html","id":null,"dir":"Reference","previous_headings":"","what":"Add a TODO list by project to a TODO.R file in the base directory — use_todo","title":"Add a TODO list by project to a TODO.R file in the base directory — use_todo","text":"Creates edits TODO.R file store TODOs. default write current RStudio project.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/use_todo.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add a TODO list by project to a TODO.R file in the base directory — use_todo","text":"","code":"use_todo(todo, proj = proj_get2(), code = FALSE)"},{"path":"https://olivroy.github.io/reuseme/reference/use_todo.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add a TODO list by project to a TODO.R file in the base directory — use_todo","text":"todo character vector lines add TODO file. See details special handling. proj default, active project, arbitrary directory, RStudio project name following directories options(reuseme.destdir), uses proj_list() case. file, write . code TRUE, render code output (default text).","code":""},{"path":"https://olivroy.github.io/reuseme/reference/use_todo.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add a TODO list by project to a TODO.R file in the base directory — use_todo","text":"TODO.R file appended todo string.","code":""},{"path":"https://olivroy.github.io/reuseme/reference/use_todo.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Add a TODO list by project to a TODO.R file in the base directory — use_todo","text":"use use_todo() version-control repository, may want use usethis::use_git_ignore(\"TODO.R\") want TODO.R file included git. using package directory, use usethis::use_build_ignore(\"TODO.R\") prevent note R CMD CHECK","code":""},{"path":[]},{"path":"https://olivroy.github.io/reuseme/reference/use_todo.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add a TODO list by project to a TODO.R file in the base directory — use_todo","text":"","code":"if (FALSE) { use_todo(\"I need to do that\") use_todo(c(\"I need to do that again\", \"youppi\")) use_todo(\"c(x, y)\", code = TRUE) use_todo(\"Here\", proj = \"my-analysis\") use_todo(c(\"my-analysis::Here\", \"I am\")) # add to a global todo. use_todo(c(\"all::Here\", \"I am\")) }"},{"path":"https://olivroy.github.io/reuseme/news/index.html","id":"reuseme-development-version","dir":"Changelog","previous_headings":"","what":"reuseme (development version)","title":"reuseme (development version)","text":"file_outline() now prints first outline element first line (encourage give informative description first line) (todos tests excluded) Improved support escaping inline markup. Add print method file_outline(). investigate ’s gone wrong, use Add file_outline() solve_file_name_conflicts() now returns number conflicts instead TRUE, FALSE rename_files2() rewritten. Now uses warn_conflicts determine . force now deprecated. now separated smaller functions easier test extend. mark_todo_as_complete() save opened documents attempting mark complete. use_todo() work platforms now. check_files_exist_in_dir() -> check_referenced_files() Require R 4.1 use base pipe rename_files2() experimental function rename data files, file names. browse_pkg() new function access pkgdown site directly. also prints links vignettes different parts website console. slice_min_max() new defaults (= TRUE)argument positions (tidy design principles) (optional arguments ...). Gains ascending parameter display max min. use_todo() allows write project use_todo(“::”) use_todo() provides handy :: shortcut `use_todo(“todo items”, “proj”) write TODO items projects. use_todo() longer fails RStudio project mark_todo_as_complete() can used multiple times sequentially throw warning (now). screenshot() works generic file paths contain numbers returns correct message. screenshot() internal cleanup. screenshot() better support Quarto blogs, gains proj argument. image saved active posts/ folder, queried using rstudioapi::documentPath(). summarise_with_total() returns factors. New na_if2() alternative dplyr::na_if() transforms x NA 1. x certain values, 2. certain logical condition TRUE.","code":"f <- proj_outline() f |> as_tibble()"}] diff --git a/sitemap.xml b/sitemap.xml index 6afc683..e8baa55 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -36,9 +36,6 @@ https://olivroy.github.io/reuseme/reference/eda-identity.html - - https://olivroy.github.io/reuseme/reference/escape_markup.html - https://olivroy.github.io/reuseme/reference/extract_cell_value.html