diff --git a/news/index.html b/news/index.html index 8db2817..ab25aed 100644 --- a/news/index.html +++ b/news/index.html @@ -36,7 +36,7 @@

Changelog

supportR Version 1.4.0.900

Development version, changes from preceding version are listed below:

-

supportR Version 1.4.0

CRAN release: 2024-06-13

diff --git a/pkgdown.yml b/pkgdown.yml index 54ae560..145ccfd 100644 --- a/pkgdown.yml +++ b/pkgdown.yml @@ -3,7 +3,7 @@ pkgdown: 2.1.0 pkgdown_sha: ~ articles: supportR: supportR.html -last_built: 2024-08-05T22:32Z +last_built: 2024-08-23T15:34Z urls: reference: https://njlyon0.github.io/supportR/reference article: https://njlyon0.github.io/supportR/articles diff --git a/search.json b/search.json index b86dadf..fd8ca26 100644 --- a/search.json +++ b/search.json @@ -1 +1 @@ -[{"path":"https://njlyon0.github.io/supportR/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2023 supportR 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://njlyon0.github.io/supportR/articles/supportR.html","id":"overview","dir":"Articles","previous_headings":"","what":"Overview","title":"supportR Vignette","text":"supportR package amalgam distinct functions ’ve written accomplish small data wrangling, quality control, visualization tasks. functions tend short narrowly-defined. additional consequence motivation creating tend inter-related united common theme. vignette feels somewhat scattered , hope doesn’t negatively affect informative willingness adopt supportR scripts! vignette describes main functions supportR using examples included function.","code":"#install.packages(\"supportR\") library(supportR)"},{"path":"https://njlyon0.github.io/supportR/articles/supportR.html","id":"data-wrangling","dir":"Articles","previous_headings":"Overview","what":"Data Wrangling","title":"supportR Vignette","text":"order demonstrate data wrangling functions supportR, ’ll use example data Dr. Allison Horst’s palmerpenguins R package. data loaded, can use summary_table function quickly get group-wise summaries retrieve generally useful summary statistics. groups argument supports vector column names group response must single numeric column. drop_na argument allows group combinations result NA automatically dropped (.e., penguin didn’t island listed dropped). mean, standard deviation (SD), sample size, standard error (SE) returned facilitate easy figure creation. also round_digits argument lets specify many digits ’d like retain mean, SD, SE. safe_rename function allows–perhaps predictably–“safe” renaming column names given data object. ‘bad’ column names corresponding ‘good’ names must specified. order entries two vectors must match (.e., first bad name replaced first good name), order need match order occur data! crop_tri allows dropping one “triangle” symmetric dataframe / matrix. also includes drop_diag argument accepts logical whether drop diagonal data object. primarily useful (find) allowing piping function opposed using base R notation removing triangle symmetric data object. array_melt allows users ‘melt’ array dimensions X, Y, Z dataframe containing columns “x”, “y”, “z”, “value” “value” whatever stored coordinates array.","code":"# Check the structure of the penguins dataset str(penguins) #> 'data.frame': 344 obs. of 8 variables: #> $ species : Factor w/ 3 levels \"Adelie\",\"Chinstrap\",..: 1 1 1 1 1 1 1 1 1 1 ... #> $ island : Factor w/ 3 levels \"Biscoe\",\"Dream\",..: 3 3 3 3 3 3 3 3 3 3 ... #> $ bill_length_mm : num 39.1 39.5 40.3 NA 36.7 39.3 38.9 39.2 34.1 42 ... #> $ bill_depth_mm : num 18.7 17.4 18 NA 19.3 20.6 17.8 19.6 18.1 20.2 ... #> $ flipper_length_mm: int 181 186 195 NA 193 190 181 195 193 190 ... #> $ body_mass_g : int 3750 3800 3250 NA 3450 3650 3625 4675 3475 4250 ... #> $ sex : Factor w/ 2 levels \"female\",\"male\": 2 1 1 NA 1 2 1 2 NA NA ... #> $ year : int 2007 2007 2007 2007 2007 2007 2007 2007 2007 2007 ... # Summarize the data supportR::summary_table(data = penguins, groups = c(\"species\", \"island\"), response = \"bill_length_mm\", drop_na = TRUE) #> species island mean std_dev sample_size std_error #> 1 Adelie Biscoe 38.98 2.48 44 0.37 #> 2 Adelie Dream 38.50 2.47 56 0.33 #> 3 Adelie Torgersen 38.95 3.03 52 0.42 #> 4 Chinstrap Dream 48.83 3.34 68 0.41 #> 5 Gentoo Biscoe 47.50 3.08 124 0.28 # Make a dataframe to demonstrate df <- data.frame(\"first\" = 1:3, \"middle\" = 4:6, \"second\" = 7:9) # Invoke the function safe_rename(data = df, bad_names = c(\"second\", \"middle\"), good_names = c(\"third\", \"second\")) #> first second third #> 1 1 4 7 #> 2 2 5 8 #> 3 3 6 9 # Define a simple matrix wtih symmetric dimensions mat <- matrix(data = c(1:2, 2:1), nrow = 2, ncol = 2) # Crop off it's lower triangle supportR::crop_tri(data = mat, drop_tri = \"lower\", drop_diag = FALSE) #> [,1] [,2] #> [1,] 1 2 #> [2,] NA 1 # Drop the diagonal as well supportR::crop_tri(data = mat, drop_tri = \"lower\", drop_diag = TRUE) #> [,1] [,2] #> [1,] NA 2 #> [2,] NA NA # Make data to fill the array vec1 <- c(5, 9, 3) vec2 <- c(10:15) # Create dimension names (x = col, y = row, z = which matrix) x_vals <- c(\"Col_1\",\"Col_2\",\"Col_3\") y_vals <- c(\"Row_1\",\"Row_2\",\"Row_3\") z_vals <- c(\"Mat_1\",\"Mat_2\") # Make an array from these components g <- array(data = c(vec1, vec2), dim = c(3, 3, 2), dimnames = list(x_vals, y_vals, z_vals)) # \"Melt\" the array into a dataframe melted <- supportR::array_melt(array = g) # Look at that top of that head(melted) #> z y x value #> 1 Mat_1 Col_1 Row_1 5 #> 2 Mat_1 Col_1 Row_2 10 #> 3 Mat_1 Col_1 Row_3 13 #> 4 Mat_1 Col_2 Row_1 9 #> 5 Mat_1 Col_2 Row_2 11 #> 6 Mat_1 Col_2 Row_3 14"},{"path":"https://njlyon0.github.io/supportR/articles/supportR.html","id":"quality-control","dir":"Articles","previous_headings":"Overview","what":"Quality Control","title":"supportR Vignette","text":"terms quality control functions, diff_check compares two vectors reports back first second (.e., “lost”) second first (.e., “gained”). find useful () comparing index columns two data objects intend join together (B) ensure columns unintentionally removed lengthy tidyverse-style pipes (%>%). diff_check also includes optional logical arguments sort return respectively either sort difference vectors return two-element set TRUE. package also includes function num_check identifies values column coerced NA .numeric run column. non-numbers identified can handle whatever way feel appropriate. num_check intended flag attention, attempt fix using method may may support. date_check similar operation checking column entries coerced NA .Date instead. Note date sufficiently badly formatted .Date throw error instead coercing NA date_check thing. num_check date_check can accept multiple column names col argument (version 1.1.1) columns checked separately. Another date column quality control function date_format_guess. function checks column dates (stored characters!) tries guess format date (.e., month/day/year, day/month/year, etc.). can make informed guess grouping column can use frequency “date” entries within groups guess whether given number day month. based assumption sampling occurs often within months across number occurs rows within grouping values likely month. Recognizing assumption may uncomfortable users, groups argument can set FALSE clearer judgment calls (.e., number >12 day, etc.). Note dates guessed function return “FORMAT UNCERTAIN” can handle using knowledge system (returning raw data need ).","code":"# Make two vectors vec1 <- c(\"x\", \"a\", \"b\") vec2 <- c(\"y\", \"z\", \"a\") # Compare them! supportR::diff_check(old = vec1, new = vec2, sort = TRUE, return = TRUE) #> Following element(s) found in old object but not new: #> [1] \"b\" \"x\" #> Following element(s) found in new object but not old: #> [1] \"y\" \"z\" #> $lost #> [1] \"b\" \"x\" #> #> $gained #> [1] \"y\" \"z\" # Make a dataframe with non-numbers in a number column fish <- data.frame(\"species\" = c(\"salmon\", \"bass\", \"halibut\", \"eel\"), \"count\" = c(1, \"14x\", \"_23\", 12)) # Use `num_check` to identify non-numbers num_check(data = fish, col = \"count\") #> For 'count', 2 non-numbers identified: '14x' | '_23' #> $count #> [1] \"14x\" \"_23\" # Make a dataframe including malformed dates sites <- data.frame(\"site\" = c(\"LTR\", \"GIL\", \"PYN\", \"RIN\"), \"visit\" = c(\"2021-01-01\", \"2021-01-0w\", \"1990\", \"2020-10-xx\")) # Now we can use our function to identify bad dates supportR::date_check(data = sites, col = \"visit\") #> For 'visit', 3 non-dates identified: '2021-01-0w' | '1990' | '2020-10-xx' #> $visit #> [1] \"2021-01-0w\" \"1990\" \"2020-10-xx\" # Make a dataframe with dates in various formats and a grouping column my_df <- data.frame(\"data_enterer\" = c(\"person A\", \"person B\", \"person B\", \"person B\", \"person C\", \"person D\", \"person E\", \"person F\", \"person G\"), \"bad_dates\" = c(\"2022.13.08\", \"2021/2/02\", \"2021/2/03\", \"2021/2/04\", \"1899/1/15\", \"10-31-1901\", \"26/11/1901\", \"08.11.2004\", \"6/10/02\")) # Now we can invoke the function! supportR::date_format_guess(data = my_df, date_col = \"bad_dates\", group_col = \"data_enterer\", return = \"dataframe\") #> Returning dataframe of data format guesses #> data_enterer bad_dates format_guess #> 1 person A 2022.13.08 year/day/month #> 2 person B 2021/2/02 year/month/day #> 3 person B 2021/2/03 year/month/day #> 4 person B 2021/2/04 year/month/day #> 5 person C 1899/1/15 year/month/day #> 6 person D 10-31-1901 month/day/year #> 7 person E 26/11/1901 day/month/year #> 8 person F 08.11.2004 FORMAT UNCERTAIN #> 9 person G 6/10/02 FORMAT UNCERTAIN # If preferred, do it without groups and return a vector supportR::date_format_guess(data = my_df, date_col = \"bad_dates\", groups = FALSE, return = \"vector\") #> Defining 'groups' is strongly recommended! If none exist, consider adding a single artificial group shared by all rows then re-run this function #> Returning vector of data format guesses #> [1] \"year/day/month\" \"FORMAT UNCERTAIN\" \"FORMAT UNCERTAIN\" \"FORMAT UNCERTAIN\" #> [5] \"year/month/day\" \"month/day/year\" \"day/month/year\" \"FORMAT UNCERTAIN\" #> [9] \"FORMAT UNCERTAIN\""},{"path":"https://njlyon0.github.io/supportR/articles/supportR.html","id":"data-visualization","dir":"Articles","previous_headings":"Overview","what":"Data Visualization","title":"supportR Vignette","text":"’ve created set custom ggplot2 theme elements guarantee figures share similar aesthetics. Feel free use theme_lyon similar preferences! theme_lyon following changes ggplot2 plot: Removes legend title background Removes gray box behind colors legend elements Removes major/minor gridlines Makes axes’ lines black Increases font size axes titles tick labels ’ve also created ordination Nonmetric Multidimensional Scaling (NMS) Principal Coordinates Analysis (PCoA) ordinations. Note function requires multidimensional scaling object created either ape::pcoa vegan::metaMDS.","code":"# Load ggplot2 library(ggplot2) # Create a plot and allow default ggplot themeing to be added ggplot(penguins, aes(x = species, y = body_mass_g, fill = species)) + geom_boxplot(outlier.shape = 24) # Compare with the same plot with my theme ggplot(penguins, aes(x = species, y = body_mass_g, fill = species)) + geom_boxplot(outlier.shape = 24) + supportR::theme_lyon() # Load data from the `vegan` package utils::data(\"varespec\", package = \"vegan\") # Make a columns to split the data into 4 groups treatment <- c(rep.int(\"Trt_1\", (nrow(varespec)/4)), rep.int(\"Trt_2\", (nrow(varespec)/4)), rep.int(\"Trt_3\", (nrow(varespec)/4)), rep.int(\"Trt_4\", (nrow(varespec)/4))) # And combine them into a single data object data <- cbind(treatment, varespec) # Actually perform multidimensional scaling mds <- vegan::metaMDS(data[-1], autotransform = FALSE, expand = FALSE, k = 2, try = 10) # With the scaled object and original dataframe we can use this function ordination(mod = mds, grps = data$treatment, x = \"bottomright\", legend = paste0(\"Treat-\", 1:4))"},{"path":"https://njlyon0.github.io/supportR/articles/supportR.html","id":"operations-outside-of-r","dir":"Articles","previous_headings":"Overview","what":"Operations Outside of R","title":"supportR Vignette","text":"Finally, ’ve written several functions allow interact APIs outside R via R functions hopefully comfortable syntax. functions rely user credentials, run non-interactively (CRAN submission) following code chunks evaluated included examples proper syntax reference.","code":""},{"path":"https://njlyon0.github.io/supportR/articles/supportR.html","id":"github-related-functions","dir":"Articles","previous_headings":"Overview > Operations Outside of R","what":"GitHub-Related Functions","title":"supportR Vignette","text":"GitHub users, ’ve developed two related functions: github_ls github_tree. github_ls accepts URL GitHub repository access (public private). creates dataframe repository’s contents including names, types, full paths within repository. Listing particular folder recursive listing nested subfolders within repository supported via additional arguments. folder argument set NULL (default) top level repository listed. github_tree extension github_ls identifies files repository creates file tree diagram folder structure simple human-readable. Unlike github_ls, github_tree supports recursive identification files beginning top level repository. however allow users exclude listings particular folders specifying names exclude argument. think particularly useful embed repository’s README.Rmd create quick--easy file map visitors use guide navigating repository’s contents.","code":"# List all files in a GitHub repository supportR::github_ls(repo = \"https://github.com/njlyon0/supportR\", recursive = TRUE, quiet = FALSE) # Or list files in only a particular folder supportR::github_ls(repo = \"https://github.com/njlyon0/supportR\", folder = \"R\", recursive = FALSE, quiet = TRUE) # Create a file tree diagram of a GitHub repository supportR::github_tree(repo = repo = \"https://github.com/njlyon0/supportR\", exclude = c(\"docs\", \"man\", \".github\"), quiet = FALSE)"},{"path":"https://njlyon0.github.io/supportR/articles/supportR.html","id":"external-file-related-functions","dir":"Articles","previous_headings":"Overview > Operations Outside of R","what":"External File-Related Functions","title":"supportR Vignette","text":"Valuable information sometimes stored markdown files –consistently formatted internally–always easily parsed R. ’ve written tabularize_md ingest markdown file collapse table still preserving nested structure headings may source file. function accepts either local markdown file name/path connection (via URL) online markdown file. ’ll demonstrate URL-based variant use local file need provide file name/path reading function (e.g., read.csv, etc.)","code":"# Identify URL to the NEWS.md file in `supportR` GitHub repo md_cxn <- url(\"https://raw.githubusercontent.com/njlyon0/supportR/main/NEWS.md\") # Transform it into a table md_df <- tabularize_md(file = md_cxn) # Close connection (just good housekeeping to do so) close(md_cxn) # Check out the table format str(md_df)"},{"path":"https://njlyon0.github.io/supportR/articles/supportR.html","id":"google-drive-related-functions","dir":"Articles","previous_headings":"Overview > Operations Outside of R","what":"Google Drive-Related Functions","title":"supportR Vignette","text":"users create RMarkdown reports want store Google Drive folder, rmd_export knits exports given R Markdown file locally user-designated Google Drive folder. Note MUST authenticate R session googledrive package permission access Drive folder supply. recommend running googledrive::drive_auth() authentication “dance” browser using rmd_export reduce chances errors.","code":"# Authorize R to interact with GoogleDrive googledrive::drive_auth() # Use `rmd_export()` to knit and export an .Rmd file supportR::rmd_export(rmd = \"my_markdown.Rmd\", in_path = file.path(\"Folder in my WD with the .Rmd named in `rmd`\"), out_path = file.path(\"Folder in my WD to save the knit file to\"), out_name = \"desired name for output\", out_type = \"html\", drive_link = \"\")"},{"path":"https://njlyon0.github.io/supportR/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Nicholas J Lyon. Author, maintainer, copyright holder.","code":""},{"path":"https://njlyon0.github.io/supportR/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Lyon N (2024). supportR: Support Functions Wrangling Visualization. R package version 1.4.0.900, https://njlyon0.github.io/supportR/, https://github.com/njlyon0/supportR.","code":"@Manual{, title = {supportR: Support Functions for Wrangling and Visualization}, author = {Nicholas J Lyon}, year = {2024}, note = {R package version 1.4.0.900, https://njlyon0.github.io/supportR/}, url = {https://github.com/njlyon0/supportR}, }"},{"path":"https://njlyon0.github.io/supportR/index.html","id":"supportr---support-functions-for-wrangling-and-visualization","dir":"","previous_headings":"","what":"Support Functions for Wrangling and Visualization","title":"Support Functions for Wrangling and Visualization","text":"supportR R package unifying theme functions honestly just wrote . said, useful functions data wrangling plotting particular, though functions purposes also included. ’ll add functions package write orphan scripts hope others might find useful stay tuned!","code":""},{"path":"https://njlyon0.github.io/supportR/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Support Functions for Wrangling and Visualization","text":"can install development version GitHub :","code":"# install.packages(\"devtools\") devtools::install_github(\"njlyon0/supportR\")"},{"path":"https://njlyon0.github.io/supportR/index.html","id":"data-wrangling","dir":"","previous_headings":"Installation","what":"Data Wrangling","title":"Support Functions for Wrangling and Visualization","text":"summary_table: Calculates summary values (mean, standard deviation, sample size, standard error) given response variable within supplied groups safe_rename: Renames columns given dataframe matching ‘bad’ names ‘good’ names name_vec: Creates named vector specified contents names. Useful creating named vectors long create manually creating vector naming cumbersome crop_tri: Removes specified “triangle” (either upper lower) symmetric data object replacing NAs. Also allows user specify whether keep also drop diagonal array_melt: “Flattens” array dimensions X, Y, Z dataframe containing columns x, y, z, value value whatever stored array coordinates","code":""},{"path":"https://njlyon0.github.io/supportR/index.html","id":"quality-control-qc","dir":"","previous_headings":"Installation","what":"Quality Control (QC)","title":"Support Functions for Wrangling and Visualization","text":"diff_check: Compares two vectors identifies elements found first second (.e., lost components) elements found second first (.e., gained components). Extremely useful prior joining two dataframes compare index column contents ensure columns unexpectedly lost complex wrangling operations num_check: Checks column(s) contain numeric values entries coerced NA .numeric run count: Counts instances unique element provided vector date_check: Checks column(s) contain date values entries coerced NA .Date run date_format_guess: Checks column containing multiple ambiguous date formats identifies best guess format date (e.g., ‘dd/mm/yyyy’ versus ‘yyyy/dd/mm’, etc.)","code":""},{"path":"https://njlyon0.github.io/supportR/index.html","id":"visualization--graphics","dir":"","previous_headings":"Installation","what":"Visualization & Graphics","title":"Support Functions for Wrangling and Visualization","text":"theme_lyon: Applies set modifications non-data aspects ggplot2 plot ensure consistent “feel” set plots ordination: Creates ordination either nonmetric multidimensional scaling (NMS) dissimilarity matrix created vegan::metaMDS principal coordinates analysis (PCoA) distance matrix returned ape::pcoa","code":""},{"path":"https://njlyon0.github.io/supportR/index.html","id":"operations-outside-of-r","dir":"","previous_headings":"Installation","what":"Operations Outside of R","title":"Support Functions for Wrangling and Visualization","text":"github_ls: Lists contents GitHub repository URL returns simple dataframe containing name, type, file path identified objects. Supports recursive listing (.e., listing contents subfolders identified first list contents) github_tree: Creates file tree diagram GitHub repository URL tabularize_md: Converts markdown file table retains nested structure headings file. Accepts either file name/path locally URL connection markdown file hosted online (e.g., GitHub repository README.md, etc.) rmd_export: Allows knitting specified R Markdown file locally simultaneously specified Google Drive folder. NOTE: must authorize R work Google Drive using googldrive::drive_auth() function work","code":""},{"path":"https://njlyon0.github.io/supportR/index.html","id":"looking-ahead","dir":"","previous_headings":"","what":"Looking Ahead","title":"Support Functions for Wrangling and Visualization","text":"functions likely developed housed within package stay tuned! Feel free post ideas new functions issue repository ’ll best build !","code":""},{"path":"https://njlyon0.github.io/supportR/reference/array_melt.html","id":null,"dir":"Reference","previous_headings":"","what":"Melt an Array into a Dataframe — array_melt","title":"Melt an Array into a Dataframe — array_melt","text":"Melts array dimensions x, y, z dataframe containing columns x, y, z, value value whatever stored array coordinates.","code":""},{"path":"https://njlyon0.github.io/supportR/reference/array_melt.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Melt an Array into a Dataframe — array_melt","text":"","code":"array_melt(array = NULL)"},{"path":"https://njlyon0.github.io/supportR/reference/array_melt.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Melt an Array into a Dataframe — array_melt","text":"array (array) array object melt dataframe","code":""},{"path":"https://njlyon0.github.io/supportR/reference/array_melt.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Melt an Array into a Dataframe — array_melt","text":"(dataframe) object containing \"flattened\" array dataframe format","code":""},{"path":"https://njlyon0.github.io/supportR/reference/array_melt.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Melt an Array into a Dataframe — array_melt","text":"","code":"# First we need to create an array to melt ## Make data to fill the array vec1 <- c(5, 9, 3) vec2 <- c(10:15) ## Create dimension names (x = col, y = row, z = which matrix) x_vals <- c(\"Col_1\",\"Col_2\",\"Col_3\") y_vals <- c(\"Row_1\",\"Row_2\",\"Row_3\") z_vals <- c(\"Mat_1\",\"Mat_2\") ## Make an array from these components g <- array(data = c(vec1, vec2), dim = c(3, 3, 2), dimnames = list(x_vals, y_vals, z_vals)) ## \"Melt\" the array into a dataframe array_melt(array = g) #> z y x value #> 1 Mat_1 Col_1 Row_1 5 #> 2 Mat_1 Col_1 Row_2 10 #> 3 Mat_1 Col_1 Row_3 13 #> 4 Mat_1 Col_2 Row_1 9 #> 5 Mat_1 Col_2 Row_2 11 #> 6 Mat_1 Col_2 Row_3 14 #> 7 Mat_1 Col_3 Row_1 3 #> 8 Mat_1 Col_3 Row_2 12 #> 9 Mat_1 Col_3 Row_3 15 #> 10 Mat_2 Col_1 Row_1 5 #> 11 Mat_2 Col_1 Row_2 10 #> 12 Mat_2 Col_1 Row_3 13 #> 13 Mat_2 Col_2 Row_1 9 #> 14 Mat_2 Col_2 Row_2 11 #> 15 Mat_2 Col_2 Row_3 14 #> 16 Mat_2 Col_3 Row_1 3 #> 17 Mat_2 Col_3 Row_2 12 #> 18 Mat_2 Col_3 Row_3 15"},{"path":"https://njlyon0.github.io/supportR/reference/count.html","id":null,"dir":"Reference","previous_headings":"","what":"Count Occurrences of Unique Vector Elements — count","title":"Count Occurrences of Unique Vector Elements — count","text":"Counts number occurrences element provided vector. Counting NAs addition non-NA values supported.","code":""},{"path":"https://njlyon0.github.io/supportR/reference/count.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Count Occurrences of Unique Vector Elements — count","text":"","code":"count(vec = NULL)"},{"path":"https://njlyon0.github.io/supportR/reference/count.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Count Occurrences of Unique Vector Elements — count","text":"vec (vector) vector containing elements count","code":""},{"path":"https://njlyon0.github.io/supportR/reference/count.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Count Occurrences of Unique Vector Elements — count","text":"(dataframe) two-column dataframe many rows unique elements provided vector. First column named \"value\" includes unique elements vector, second column named \"count\" includes number occurrences vector element.","code":""},{"path":"https://njlyon0.github.io/supportR/reference/count.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Count Occurrences of Unique Vector Elements — count","text":"","code":"# Count instances of vector elements count(vec = c(1, 1, NA, \"a\", 1, \"a\", NA, \"x\")) #> value count #> 1 1 3 #> 2 2 #> 3 a 2 #> 4 x 1"},{"path":"https://njlyon0.github.io/supportR/reference/crop_tri.html","id":null,"dir":"Reference","previous_headings":"","what":"Crop a Triangle from Data Object — crop_tri","title":"Crop a Triangle from Data Object — crop_tri","text":"Accepts symmetric data object replaces chosen triangle NAs. Also allows user choose whether keep drop diagonal data object","code":""},{"path":"https://njlyon0.github.io/supportR/reference/crop_tri.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Crop a Triangle from Data Object — crop_tri","text":"","code":"crop_tri(data = NULL, drop_tri = \"upper\", drop_diag = FALSE)"},{"path":"https://njlyon0.github.io/supportR/reference/crop_tri.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Crop a Triangle from Data Object — crop_tri","text":"data (dataframe, dataframe-like, matrix) symmetric data object remove one triangles drop_tri (character) triangle replace NAs, either \"upper\" \"lower\" drop_diag (logical) whether drop diagonal data object (defaults FALSE)","code":""},{"path":"https://njlyon0.github.io/supportR/reference/crop_tri.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Crop a Triangle from Data Object — crop_tri","text":"(dataframe dataframe-like) data object desired triangle removed either without diagonal","code":""},{"path":"https://njlyon0.github.io/supportR/reference/crop_tri.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Crop a Triangle from Data Object — crop_tri","text":"","code":"# Define a simple matrix wtih symmetric dimensions mat <- matrix(data = c(1:2, 2:1), nrow = 2, ncol = 2) # Crop off it's lower triangle supportR::crop_tri(data = mat, drop_tri = \"lower\", drop_diag = FALSE) #> [,1] [,2] #> [1,] 1 2 #> [2,] NA 1"},{"path":"https://njlyon0.github.io/supportR/reference/date_check.html","id":null,"dir":"Reference","previous_headings":"","what":"Check Columns for Non-Dates — date_check","title":"Check Columns for Non-Dates — date_check","text":"Identifies elements column(s) changed NA .Date used column(s). useful quickly identifying \"problem\" entries ostensibly date column(s) /read character.","code":""},{"path":"https://njlyon0.github.io/supportR/reference/date_check.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check Columns for Non-Dates — date_check","text":"","code":"date_check(data = NULL, col = NULL)"},{"path":"https://njlyon0.github.io/supportR/reference/date_check.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Check Columns for Non-Dates — date_check","text":"data (dataframe) object containing least one column supposed dates col (character numeric) name(s) column number(s) column(s) containing putative dates data object","code":""},{"path":"https://njlyon0.github.io/supportR/reference/date_check.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check Columns for Non-Dates — date_check","text":"(list) malformed dates supplied column separate list elements","code":""},{"path":"https://njlyon0.github.io/supportR/reference/date_check.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Check Columns for Non-Dates — date_check","text":"","code":"# Make a dataframe to test the function loc <- c(\"LTR\", \"GIL\", \"PYN\", \"RIN\") time <- c(\"2021-01-01\", \"2021-01-0w\", \"1990\", \"2020-10-xx\") time2 <- c(\"1880-08-08\", \"2021-01-02\", \"1992\", \"2049-11-01\") time3 <- c(\"2022-10-31\", \"tomorrow\", \"1993\", NA) # Assemble our vectors into a dataframe sites <- data.frame(\"site\" = loc, \"first_visit\" = time, \"second\" = time2, \"third\" = time3) # Use `date_check()` to return only the entries that would be lost date_check(data = sites, col = c(\"first_visit\", \"second\", \"third\")) #> For 'first_visit', 3 non-dates identified: '2021-01-0w' | '1990' | '2020-10-xx' #> For 'second', 1 non-dates identified: '1992' #> For 'third', 2 non-dates identified: 'tomorrow' | '1993' #> $first_visit #> [1] \"2021-01-0w\" \"1990\" \"2020-10-xx\" #> #> $second #> [1] \"1992\" #> #> $third #> [1] \"tomorrow\" \"1993\" #>"},{"path":"https://njlyon0.github.io/supportR/reference/date_format_guess.html","id":null,"dir":"Reference","previous_headings":"","what":"Identify Probable Format for Ambiguous Date Formats — date_format_guess","title":"Identify Probable Format for Ambiguous Date Formats — date_format_guess","text":"column containing multiple date formats (e.g., MM/DD/YYYY, \"YYYY/MM/DD, etc.) identifies probable format date. Provision grouping column improves inference. formats determined flagged \"FORMAT UNCERTAIN\" human double-checking. useful quickly sorting bulk ambiguous dates clear categories later conditional wrangling.","code":""},{"path":"https://njlyon0.github.io/supportR/reference/date_format_guess.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Identify Probable Format for Ambiguous Date Formats — date_format_guess","text":"","code":"date_format_guess( data = NULL, date_col = NULL, groups = TRUE, group_col = NULL, return = \"dataframe\", quiet = FALSE )"},{"path":"https://njlyon0.github.io/supportR/reference/date_format_guess.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Identify Probable Format for Ambiguous Date Formats — date_format_guess","text":"data (dataframe) object containing least one column ambiguous dates date_col (character) name column containing ambiguous dates groups (logical) whether groups exist dataframe / used (defaults TRUE) group_col (character) name column containing grouping variable return (character) either \"dataframe\" \"vector\" depending whether user wants date format \"guesses\" returned new column dataframe vector quiet (logical) whether certain optional messages displayed (defaults FALSE)","code":""},{"path":"https://njlyon0.github.io/supportR/reference/date_format_guess.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Identify Probable Format for Ambiguous Date Formats — date_format_guess","text":"(dataframe character) object containing date format guesses","code":""},{"path":"https://njlyon0.github.io/supportR/reference/date_format_guess.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Identify Probable Format for Ambiguous Date Formats — date_format_guess","text":"","code":"# Create dataframe of example ambiguous dates & grouping variable my_df <- data.frame('data_enterer' = c('person A', 'person B', 'person B', 'person B', 'person C', 'person D', 'person E', 'person F', 'person G'), 'bad_dates' = c('2022.13.08', '2021/2/02', '2021/2/03', '2021/2/04', '1899/1/15', '10-31-1901', '26/11/1901', '08.11.2004', '6/10/02')) # Now we can invoke the function! date_format_guess(data = my_df, date_col = \"bad_dates\", group_col = \"data_enterer\", return = \"dataframe\") #> Returning dataframe of data format guesses #> data_enterer bad_dates format_guess #> 1 person A 2022.13.08 year/day/month #> 2 person B 2021/2/02 year/month/day #> 3 person B 2021/2/03 year/month/day #> 4 person B 2021/2/04 year/month/day #> 5 person C 1899/1/15 year/month/day #> 6 person D 10-31-1901 month/day/year #> 7 person E 26/11/1901 day/month/year #> 8 person F 08.11.2004 FORMAT UNCERTAIN #> 9 person G 6/10/02 FORMAT UNCERTAIN # If preferred, do it without groups and return a vector date_format_guess(data = my_df, date_col = \"bad_dates\", groups = FALSE, return = \"vector\") #> Defining 'groups' is strongly recommended! If none exist, consider adding a single artificial group shared by all rows then re-run this function #> Returning vector of data format guesses #> [1] \"year/day/month\" \"FORMAT UNCERTAIN\" \"FORMAT UNCERTAIN\" \"FORMAT UNCERTAIN\" #> [5] \"year/month/day\" \"month/day/year\" \"day/month/year\" \"FORMAT UNCERTAIN\" #> [9] \"FORMAT UNCERTAIN\""},{"path":"https://njlyon0.github.io/supportR/reference/diff_check.html","id":null,"dir":"Reference","previous_headings":"","what":"Compare Difference Between Two Vectors — diff_check","title":"Compare Difference Between Two Vectors — diff_check","text":"Reflexively compares two vectors identifies (1) elements found first second (.e., \"lost\" components) (2) elements found second first (.e., \"gained\" components). particularly helpful manipulating dataframe comparing columns lost gained wrangling steps. Alternately can compare contents two columns see two dataframes differ.","code":""},{"path":"https://njlyon0.github.io/supportR/reference/diff_check.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compare Difference Between Two Vectors — diff_check","text":"","code":"diff_check(old = NULL, new = NULL, sort = TRUE, return = FALSE)"},{"path":"https://njlyon0.github.io/supportR/reference/diff_check.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compare Difference Between Two Vectors — diff_check","text":"old (vector) starting / original object new (vector) ending / modified object sort (logical) whether sort difference two vectors return (logical) whether return two vectors 2-element list","code":""},{"path":"https://njlyon0.github.io/supportR/reference/diff_check.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compare Difference Between Two Vectors — diff_check","text":"return value (unless return = TRUE), called side effects. return = TRUE, returns two-element list","code":""},{"path":"https://njlyon0.github.io/supportR/reference/diff_check.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Compare Difference Between Two Vectors — diff_check","text":"","code":"# Make two vectors vec1 <- c(\"x\", \"a\", \"b\") vec2 <- c(\"y\", \"z\", \"a\") # Compare them! diff_check(old = vec1, new = vec2, return = FALSE) #> Following element(s) found in old object but not new: #> [1] \"b\" \"x\" #> Following element(s) found in new object but not old: #> [1] \"y\" \"z\" # Return the difference for later use diff_out <- diff_check(old = vec1, new = vec2, return = TRUE) #> Following element(s) found in old object but not new: #> [1] \"b\" \"x\" #> Following element(s) found in new object but not old: #> [1] \"y\" \"z\" diff_out #> $lost #> [1] \"b\" \"x\" #> #> $gained #> [1] \"y\" \"z\" #>"},{"path":"https://njlyon0.github.io/supportR/reference/force_num.html","id":null,"dir":"Reference","previous_headings":"","what":"Force Coerce to Numeric — force_num","title":"Force Coerce to Numeric — force_num","text":"Coerces vector numeric vector automatically silences NAs introduced coercion warning. Useful cases non-numbers known exist vector coercion NA expected / unremarkable. Essentially just way forcing coercion succinctly wrapping .numeric suppressWarnings.","code":""},{"path":"https://njlyon0.github.io/supportR/reference/force_num.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Force Coerce to Numeric — force_num","text":"","code":"force_num(x = NULL)"},{"path":"https://njlyon0.github.io/supportR/reference/force_num.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Force Coerce to Numeric — force_num","text":"x (non-numeric) vector containing elements coerced class numeric","code":""},{"path":"https://njlyon0.github.io/supportR/reference/force_num.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Force Coerce to Numeric — force_num","text":"(numeric) vector numeric values","code":""},{"path":"https://njlyon0.github.io/supportR/reference/force_num.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Force Coerce to Numeric — force_num","text":"","code":"# Coerce a character vector to numeric without throwing a warning force_num(x = c(2, \"A\", 4)) #> [1] 2 NA 4"},{"path":"https://njlyon0.github.io/supportR/reference/github_ls.html","id":null,"dir":"Reference","previous_headings":"","what":"List Objects in a GitHub Repository — github_ls","title":"List Objects in a GitHub Repository — github_ls","text":"Accepts GitHub repository URL identifies files specified folder. folder specified, lists top-level repository contents. Recursive listing sub-folders supported additional argument. function works repositories (public private) access.","code":""},{"path":"https://njlyon0.github.io/supportR/reference/github_ls.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"List Objects in a GitHub Repository — github_ls","text":"","code":"github_ls(repo = NULL, folder = NULL, recursive = TRUE, quiet = FALSE)"},{"path":"https://njlyon0.github.io/supportR/reference/github_ls.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"List Objects in a GitHub Repository — github_ls","text":"repo (character) full URL GitHub repository (including \"github.com\") folder (NULL/character) either NULL name folder list. NULL, top-level contents repository listed recursive (logical) whether recursively list contents (.e., list contents sub-folders identified within previously identified sub-folders) quiet (logical) whether print informative message contents folder listed","code":""},{"path":"https://njlyon0.github.io/supportR/reference/github_ls.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"List Objects in a GitHub Repository — github_ls","text":"(dataframe) three-column dataframe including (1) names contents, (2) type content item (e.g., file/directory/etc.), (3) full path starting folder item","code":""},{"path":"https://njlyon0.github.io/supportR/reference/github_ls.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"List Objects in a GitHub Repository — github_ls","text":"","code":"if (FALSE) { # \\dontrun{ # List complete contents of the `supportR` package repository github_ls(repo = \"https://github.com/njlyon0/supportR\", recursive = TRUE, quiet = FALSE) } # }"},{"path":"https://njlyon0.github.io/supportR/reference/github_ls_single.html","id":null,"dir":"Reference","previous_headings":"","what":"List Objects in a Single Folder of a GitHub Repository — github_ls_single","title":"List Objects in a Single Folder of a GitHub Repository — github_ls_single","text":"Accepts GitHub repository URL identifies files specified folder. folder specified, lists top-level repository contents. function works repositories (public private) access.","code":""},{"path":"https://njlyon0.github.io/supportR/reference/github_ls_single.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"List Objects in a Single Folder of a GitHub Repository — github_ls_single","text":"","code":"github_ls_single(repo = NULL, folder = NULL)"},{"path":"https://njlyon0.github.io/supportR/reference/github_ls_single.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"List Objects in a Single Folder of a GitHub Repository — github_ls_single","text":"repo (character) full URL GitHub repository (including \"github.com\") folder (NULL/character) either NULL name folder list. NULL, top-level contents repository listed","code":""},{"path":"https://njlyon0.github.io/supportR/reference/github_ls_single.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"List Objects in a Single Folder of a GitHub Repository — github_ls_single","text":"(dataframe) two-column dataframe including (1) names contents (2) type content item (e.g., file/directory/etc.)","code":""},{"path":"https://njlyon0.github.io/supportR/reference/github_ls_single.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"List Objects in a Single Folder of a GitHub Repository — github_ls_single","text":"","code":"if (FALSE) { # \\dontrun{ # List contents of the top-level of the `supportR` package repository github_ls_single(repo = \"https://github.com/njlyon0/supportR\") } # }"},{"path":"https://njlyon0.github.io/supportR/reference/github_tree.html","id":null,"dir":"Reference","previous_headings":"","what":"Create File Tree of a GitHub Repository — github_tree","title":"Create File Tree of a GitHub Repository — github_tree","text":"Recursively identifies files GitHub repository creates file tree using data.tree package create simple, human-readable visualization folder hierarchy. Folders can specified exclusion case number elements within listed names objects. function works repositories (public private) access.","code":""},{"path":"https://njlyon0.github.io/supportR/reference/github_tree.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create File Tree of a GitHub Repository — github_tree","text":"","code":"github_tree(repo = NULL, exclude = NULL, quiet = FALSE)"},{"path":"https://njlyon0.github.io/supportR/reference/github_tree.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create File Tree of a GitHub Repository — github_tree","text":"repo (character) full URL github repository (including \"github.com\") exclude (character) vector folder names exclude file tree. NULL (default) folders excluded quiet (logical) whether print informative message contents folder listed tree prepared information","code":""},{"path":"https://njlyon0.github.io/supportR/reference/github_tree.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create File Tree of a GitHub Repository — github_tree","text":"(node / R6) data.tree package object class","code":""},{"path":"https://njlyon0.github.io/supportR/reference/github_tree.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create File Tree of a GitHub Repository — github_tree","text":"","code":"if (FALSE) { # \\dontrun{ # Create a file tree for the `supportR` package GitHub repository github_tree(repo = \"github.com/njlyon0/supportR\", exclude = c(\"man\", \"docs\", \".github\")) } # }"},{"path":"https://njlyon0.github.io/supportR/reference/multi_date_check.html","id":null,"dir":"Reference","previous_headings":"","what":"Check Multiple Columns for Non-Dates — multi_date_check","title":"Check Multiple Columns for Non-Dates — multi_date_check","text":"function deprecated realized just special case date_check() function.","code":""},{"path":"https://njlyon0.github.io/supportR/reference/multi_date_check.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check Multiple Columns for Non-Dates — multi_date_check","text":"","code":"multi_date_check(data = NULL, col_vec = NULL)"},{"path":"https://njlyon0.github.io/supportR/reference/multi_date_check.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Check Multiple Columns for Non-Dates — multi_date_check","text":"data (dataframe) object containing least one column supposed dates col_vec (character numeric) vector names column numbers columns containing putative dates data object","code":""},{"path":"https://njlyon0.github.io/supportR/reference/multi_date_check.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check Multiple Columns for Non-Dates — multi_date_check","text":"list length col_vec malformed dates column respective element","code":""},{"path":"https://njlyon0.github.io/supportR/reference/multi_date_check.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Check Multiple Columns for Non-Dates — multi_date_check","text":"","code":"# Make a dataframe to test the function loc <- c(\"LTR\", \"GIL\", \"PYN\", \"RIN\") time <- c('2021-01-01', '2021-01-0w', '1990', '2020-10-xx') time2 <- c('1880-08-08', '2021-01-02', '1992', '2049-11-01') time3 <- c('2022-10-31', 'tomorrow', '1993', NA) # Assemble our vectors into a dataframe sites <- data.frame('site' = loc, 'first_visit' = time, \"second\" = time2, \"third\" = time3) # Use `multi_date_check()` to return only the entries that would be lost multi_date_check(data = sites, col_vec = c(\"first_visit\", \"second\", \"third\")) #> Warning: `multi_date_check()` was deprecated in supportR 1.2.0. #> ℹ Please use `date_check()` instead. #> For 'first_visit', 3 non-dates identified: '2021-01-0w' | '1990' | '2020-10-xx' #> For 'second', 1 non-dates identified: '1992' #> For 'third', 2 non-dates identified: 'tomorrow' | '1993' #> $first_visit #> [1] \"2021-01-0w\" \"1990\" \"2020-10-xx\" #> #> $second #> [1] \"1992\" #> #> $third #> [1] \"tomorrow\" \"1993\" #>"},{"path":"https://njlyon0.github.io/supportR/reference/multi_num_check.html","id":null,"dir":"Reference","previous_headings":"","what":"Check Multiple Columns for Non-Numbers — multi_num_check","title":"Check Multiple Columns for Non-Numbers — multi_num_check","text":"function deprecated realized just special case num_check() function.","code":""},{"path":"https://njlyon0.github.io/supportR/reference/multi_num_check.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check Multiple Columns for Non-Numbers — multi_num_check","text":"","code":"multi_num_check(data = NULL, col_vec = NULL)"},{"path":"https://njlyon0.github.io/supportR/reference/multi_num_check.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Check Multiple Columns for Non-Numbers — multi_num_check","text":"data (dataframe) object containing least one column supposed numbers col_vec (character numeric) vector names column numbers columns containing putative numbers data object","code":""},{"path":"https://njlyon0.github.io/supportR/reference/multi_num_check.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check Multiple Columns for Non-Numbers — multi_num_check","text":"list length col_vec malformed numbers column respective element","code":""},{"path":"https://njlyon0.github.io/supportR/reference/multi_num_check.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Check Multiple Columns for Non-Numbers — multi_num_check","text":"","code":"# Create dataframe with a numeric column where some entries would be coerced into NA spp <- c('salmon', 'bass', 'halibut', 'eel') ct <- c(1, '14x', '_23', 12) ct2 <- c('a', '2', '4', '0') ct3 <- c(NA, 'Y', 'typo', '2') fish <- data.frame('species' = spp, 'count' = ct, 'num_col2' = ct2, 'third_count' = ct3) # Use `multi_num_check()` to return only the entries that would be lost multi_num_check(data = fish, col_vec = c(\"count\", \"num_col2\", \"third_count\")) #> Warning: `multi_num_check()` was deprecated in supportR 1.2.0. #> ℹ Please use `num_check()` instead. #> For 'count', 2 non-numbers identified: '14x' | '_23' #> For 'num_col2', 1 non-numbers identified: 'a' #> For 'third_count', 2 non-numbers identified: 'Y' | 'typo' #> $count #> [1] \"14x\" \"_23\" #> #> $num_col2 #> [1] \"a\" #> #> $third_count #> [1] \"Y\" \"typo\" #>"},{"path":"https://njlyon0.github.io/supportR/reference/name_vec.html","id":null,"dir":"Reference","previous_headings":"","what":"Create Named Vector — name_vec","title":"Create Named Vector — name_vec","text":"Create named vector single line without either manually defining names outset (e.g., c(\"name_1\" = 1, \"name_2\" = 2, ...) spending second line assign names existing vector (e.g., names(vec) <- c(\"name_1\", \"name_2\", ...)). Useful cases need named vector within pipe want break two pipes just define named vector (see tidyr::separate_wider_position)","code":""},{"path":"https://njlyon0.github.io/supportR/reference/name_vec.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create Named Vector — name_vec","text":"","code":"name_vec(content = NULL, name = NULL)"},{"path":"https://njlyon0.github.io/supportR/reference/name_vec.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create Named Vector — name_vec","text":"content (vector) content vector name (vector) names assign vector (must order)","code":""},{"path":"https://njlyon0.github.io/supportR/reference/name_vec.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create Named Vector — name_vec","text":"(named vector) vector contents content argument names name argument","code":""},{"path":"https://njlyon0.github.io/supportR/reference/name_vec.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create Named Vector — name_vec","text":"","code":"# Create a named vector name_vec(content = 1:10, name = paste0(\"text_\", 1:10)) #> text_1 text_2 text_3 text_4 text_5 text_6 text_7 text_8 text_9 text_10 #> 1 2 3 4 5 6 7 8 9 10"},{"path":"https://njlyon0.github.io/supportR/reference/nms_ord.html","id":null,"dir":"Reference","previous_headings":"","what":"Publication-Quality Non-metric Multi-dimensional Scaling (NMS) Ordinations — nms_ord","title":"Publication-Quality Non-metric Multi-dimensional Scaling (NMS) Ordinations — nms_ord","text":"function superseded ordination just special case function. Additionally, ordination provides users much control internal graphics functions used create fundamental elements graph Produces Non-Metric Multi-dimensional Scaling (NMS) ordinations 10 groups. Assigns unique color group draws ellipse around standard deviation points. Automatically adds stress (see vegan::metaMDS explanation \"stress\") legend title. five hollow shapes (see ?graphics::pch()) shapes re-used maximum 2 times 5 groups supplied.","code":""},{"path":"https://njlyon0.github.io/supportR/reference/nms_ord.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Publication-Quality Non-metric Multi-dimensional Scaling (NMS) Ordinations — nms_ord","text":"","code":"nms_ord( mod = NULL, groupcol = NULL, title = NA, colors = c(\"#41b6c4\", \"#c51b7d\", \"#7fbc41\", \"#d73027\", \"#4575b4\", \"#e08214\", \"#8073ac\", \"#f1b6da\", \"#b8e186\", \"#8c96c6\"), shapes = rep(x = 21:25, times = 2), lines = rep(x = 1, times = 10), pt_size = 1.5, pt_alpha = 1, lab_text_size = 1.25, axis_text_size = 1, leg_pos = \"bottomleft\", leg_cont = unique(groupcol) )"},{"path":"https://njlyon0.github.io/supportR/reference/nms_ord.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Publication-Quality Non-metric Multi-dimensional Scaling (NMS) Ordinations — nms_ord","text":"mod (metaMDS/monoMDS) object returned vegan::metaMDS groupcol (dataframe) column specification data includes groups (accepts either bracket $ notation) title (character) string use title plot colors (character) vector colors (hexadecimal codes) length >= group levels (default colorblind safe need 10 built-unique colors) shapes (numeric) vector shapes (values accepted pch) length >= group levels lines (numeric) vector line types (integers) length >= group levels pt_size (numeric) value point size (controlled character expansion .e., cex) pt_alpha (numeric) value transparency points (ranges 0 1) lab_text_size (numeric) value axis label text size axis_text_size (numeric) value axis tick text size leg_pos (character numeric) legend position, either numeric vector x/y coordinates shorthand accepted graphics::legend leg_cont (character) vector desired legend entries. Defaults unique entries groupcol argument (argument provided case syntax legend contents differ data contents)","code":""},{"path":"https://njlyon0.github.io/supportR/reference/nms_ord.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Publication-Quality Non-metric Multi-dimensional Scaling (NMS) Ordinations — nms_ord","text":"(plot) base R ordination ellipse group","code":""},{"path":"https://njlyon0.github.io/supportR/reference/nms_ord.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Publication-Quality Non-metric Multi-dimensional Scaling (NMS) Ordinations — nms_ord","text":"","code":"# \\donttest{ # Use data from the vegan package utils::data(\"varespec\", package = 'vegan') resp <- varespec # Make some columns of known number of groups factor_4lvl <- c(rep.int(\"Trt1\", (nrow(resp)/4)), rep.int(\"Trt2\", (nrow(resp)/4)), rep.int(\"Trt3\", (nrow(resp)/4)), rep.int(\"Trt4\", (nrow(resp)/4))) # And combine them into a single data object data <- cbind(factor_4lvl, resp) # Actually perform multidimensional scaling mds <- vegan::metaMDS(data[-1], autotransform = FALSE, expand = FALSE, k = 2, try = 50) #> Run 0 stress 0.1000211 #> Run 1 stress 0.1715395 #> Run 2 stress 0.1000211 #> ... Procrustes: rmse 1.068764e-05 max resid 4.170213e-05 #> ... Similar to previous best #> Run 3 stress 0.1605747 #> Run 4 stress 0.1613668 #> Run 5 stress 0.1000211 #> ... New best solution #> ... Procrustes: rmse 3.277054e-06 max resid 1.416261e-05 #> ... Similar to previous best #> Run 6 stress 0.1607499 #> Run 7 stress 0.1000211 #> ... New best solution #> ... Procrustes: rmse 3.547968e-07 max resid 1.025797e-06 #> ... Similar to previous best #> Run 8 stress 0.1000211 #> ... Procrustes: rmse 6.553308e-06 max resid 2.717474e-05 #> ... Similar to previous best #> Run 9 stress 0.1000211 #> ... Procrustes: rmse 1.847283e-05 max resid 5.887532e-05 #> ... Similar to previous best #> Run 10 stress 0.1000211 #> ... Procrustes: rmse 1.638284e-06 max resid 6.797019e-06 #> ... Similar to previous best #> Run 11 stress 0.1607505 #> Run 12 stress 0.2186732 #> Run 13 stress 0.1000211 #> ... Procrustes: rmse 9.336186e-06 max resid 4.046768e-05 #> ... Similar to previous best #> Run 14 stress 0.1000211 #> ... Procrustes: rmse 1.860223e-05 max resid 7.962999e-05 #> ... Similar to previous best #> Run 15 stress 0.1000211 #> ... New best solution #> ... Procrustes: rmse 3.514954e-06 max resid 1.498052e-05 #> ... Similar to previous best #> Run 16 stress 0.1000211 #> ... Procrustes: rmse 1.420825e-05 max resid 6.162886e-05 #> ... Similar to previous best #> Run 17 stress 0.160494 #> Run 18 stress 0.1000211 #> ... Procrustes: rmse 6.506975e-06 max resid 2.816072e-05 #> ... Similar to previous best #> Run 19 stress 0.1733341 #> Run 20 stress 0.1000211 #> ... Procrustes: rmse 1.532844e-05 max resid 6.633466e-05 #> ... Similar to previous best #> *** Best solution repeated 4 times # With the scaled object and original dataframe we can use this function nms_ord(mod = mds, groupcol = data$factor_4lvl, title = '4-Level NMS', leg_pos = 'topright', leg_cont = as.character(1:4)) # }"},{"path":"https://njlyon0.github.io/supportR/reference/num_check.html","id":null,"dir":"Reference","previous_headings":"","what":"Check Columns for Non-Numbers — num_check","title":"Check Columns for Non-Numbers — num_check","text":"Identifies elements column(s) changed NA .numeric used column(s). useful quickly identifying \"problem\" entries ostensibly numeric column(s) /read character.","code":""},{"path":"https://njlyon0.github.io/supportR/reference/num_check.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check Columns for Non-Numbers — num_check","text":"","code":"num_check(data = NULL, col = NULL)"},{"path":"https://njlyon0.github.io/supportR/reference/num_check.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Check Columns for Non-Numbers — num_check","text":"data (dataframe) object containing least one column supposed numbers col (character numeric) name(s) column number(s) column(s) containing putative numbers data object","code":""},{"path":"https://njlyon0.github.io/supportR/reference/num_check.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check Columns for Non-Numbers — num_check","text":"(list) malformed numbers supplied column separate list elements","code":""},{"path":"https://njlyon0.github.io/supportR/reference/num_check.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Check Columns for Non-Numbers — num_check","text":"","code":"# Create dataframe with a numeric column where some entries would be coerced into NA spp <- c(\"salmon\", \"bass\", \"halibut\", \"eel\") ct <- c(1, \"14x\", \"_23\", 12) ct2 <- c(\"a\", \"2\", \"4\", \"0\") ct3 <- c(NA, \"Y\", \"typo\", \"2\") fish <- data.frame(\"species\" = spp, \"count\" = ct, \"num_col2\" = ct2, \"third_count\" = ct3) # Use `num_check()` to return only the entries that would be lost num_check(data = fish, col = c(\"count\", \"num_col2\", \"third_count\")) #> For 'count', 2 non-numbers identified: '14x' | '_23' #> For 'num_col2', 1 non-numbers identified: 'a' #> For 'third_count', 2 non-numbers identified: 'Y' | 'typo' #> $count #> [1] \"14x\" \"_23\" #> #> $num_col2 #> [1] \"a\" #> #> $third_count #> [1] \"Y\" \"typo\" #>"},{"path":"https://njlyon0.github.io/supportR/reference/ordination.html","id":null,"dir":"Reference","previous_headings":"","what":"Create an Ordination with Ellipses for Groups — ordination","title":"Create an Ordination with Ellipses for Groups — ordination","text":"Produces Nonmetric Multidimensional Scaling (NMS) Principal Coordinate Analysis (PCoA) 10 groups. Draws ellipse around standard deviation points group. default, assigns unique color (colorblind-safe) point shape group. user supplies colors/shapes function can support 10 groups. NMS ordinations, includes stress legend title (see ?vegan::metaMDS explanation \"stress\"). PCoA ordinations includes percent variation explained parenthetically axis labels.","code":""},{"path":"https://njlyon0.github.io/supportR/reference/ordination.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create an Ordination with Ellipses for Groups — ordination","text":"","code":"ordination(mod = NULL, grps = NULL, ...)"},{"path":"https://njlyon0.github.io/supportR/reference/ordination.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create an Ordination with Ellipses for Groups — ordination","text":"mod (pcoa | monoMDS/metaMDS) object returned ape::pcoa vegan::metaMDS grps (vector) vector categorical groups data. Must length number rows original data object ... additional arguments passed graphics::plot, graphics::points, scales::alpha, vegan::ordiellipse, graphics::legend. Open GitHub Issue function must support additional arguments","code":""},{"path":"https://njlyon0.github.io/supportR/reference/ordination.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create an Ordination with Ellipses for Groups — ordination","text":"(plot) base R ordination ellipse group","code":""},{"path":"https://njlyon0.github.io/supportR/reference/ordination.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create an Ordination with Ellipses for Groups — ordination","text":"","code":"# \\donttest{ # Use data from the vegan package utils::data(\"varespec\", package = 'vegan') # Make some columns of known number of groups treatment <- c(rep.int(\"Trt1\", (nrow(varespec)/4)), rep.int(\"Trt2\", (nrow(varespec)/4)), rep.int(\"Trt3\", (nrow(varespec)/4)), rep.int(\"Trt4\", (nrow(varespec)/4))) # And combine them into a single data object data <- cbind(treatment, varespec) # Get a distance matrix from the data dist <- vegan::vegdist(varespec, method = 'kulczynski') # Perform PCoA / NMS pcoa_mod <- ape::pcoa(dist) nms_mod <- vegan::metaMDS(data[-1], autotransform = FALSE, expand = FALSE, k = 2, try = 50) #> Run 0 stress 0.1000211 #> Run 1 stress 0.160494 #> Run 2 stress 0.1000211 #> ... Procrustes: rmse 2.418569e-05 max resid 0.0001051768 #> ... Similar to previous best #> Run 3 stress 0.173334 #> Run 4 stress 0.1000211 #> ... New best solution #> ... Procrustes: rmse 4.052296e-06 max resid 1.763271e-05 #> ... Similar to previous best #> Run 5 stress 0.1000211 #> ... Procrustes: rmse 5.817102e-07 max resid 2.50098e-06 #> ... Similar to previous best #> Run 6 stress 0.1616352 #> Run 7 stress 0.1000211 #> ... Procrustes: rmse 3.830352e-07 max resid 1.366122e-06 #> ... Similar to previous best #> Run 8 stress 0.1000211 #> ... Procrustes: rmse 8.692326e-06 max resid 3.779172e-05 #> ... Similar to previous best #> Run 9 stress 0.1000211 #> ... Procrustes: rmse 1.426434e-06 max resid 6.135848e-06 #> ... Similar to previous best #> Run 10 stress 0.1000211 #> ... Procrustes: rmse 2.061586e-06 max resid 8.946507e-06 #> ... Similar to previous best #> Run 11 stress 0.1000211 #> ... Procrustes: rmse 9.422265e-06 max resid 4.095289e-05 #> ... Similar to previous best #> Run 12 stress 0.1000211 #> ... Procrustes: rmse 2.74398e-05 max resid 0.0001180424 #> ... Similar to previous best #> Run 13 stress 0.1613105 #> Run 14 stress 0.1616352 #> Run 15 stress 0.1532704 #> Run 16 stress 0.1000211 #> ... New best solution #> ... Procrustes: rmse 5.073255e-06 max resid 2.188445e-05 #> ... Similar to previous best #> Run 17 stress 0.1000211 #> ... Procrustes: rmse 4.585748e-06 max resid 1.96768e-05 #> ... Similar to previous best #> Run 18 stress 0.1000211 #> ... Procrustes: rmse 5.191166e-06 max resid 2.179527e-05 #> ... Similar to previous best #> Run 19 stress 0.1000211 #> ... New best solution #> ... Procrustes: rmse 1.657658e-06 max resid 5.468007e-06 #> ... Similar to previous best #> Run 20 stress 0.1000211 #> ... Procrustes: rmse 1.148052e-05 max resid 4.585103e-05 #> ... Similar to previous best #> *** Best solution repeated 2 times # Create PCoA ordination (with optional agruments) ordination(mod = pcoa_mod, grps = data$treatment, bg = c(\"red\", \"blue\", \"purple\", \"orange\"), lty = 2, col = \"black\") # Create NMS ordination ordination(mod = nms_mod, grps = data$treatment, alpha = 0.3, x = \"topright\", legend = LETTERS[1:4]) # }"},{"path":"https://njlyon0.github.io/supportR/reference/pcoa_ord.html","id":null,"dir":"Reference","previous_headings":"","what":"Publication-Quality Principal Coordinates Analysis (PCoA) Ordinations — pcoa_ord","title":"Publication-Quality Principal Coordinates Analysis (PCoA) Ordinations — pcoa_ord","text":"function superseded ordination just special case function. Additionally, ordination provides users much control internal graphics functions used create fundamental elements graph Produces Principal Coordinates Analysis (PCoA) ordinations 10 groups. Assigns unique color group draws ellipse around standard deviation points. Automatically adds percent variation explained first two principal component axes parenthetically axis labels. five hollow shapes (see ?graphics::pch) shapes re-used maximum 2 times 5 groups supplied.","code":""},{"path":"https://njlyon0.github.io/supportR/reference/pcoa_ord.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Publication-Quality Principal Coordinates Analysis (PCoA) Ordinations — pcoa_ord","text":"","code":"pcoa_ord( mod = NULL, groupcol = NULL, title = NA, colors = c(\"#41b6c4\", \"#c51b7d\", \"#7fbc41\", \"#d73027\", \"#4575b4\", \"#e08214\", \"#8073ac\", \"#f1b6da\", \"#b8e186\", \"#8c96c6\"), shapes = rep(x = 21:25, times = 2), lines = rep(x = 1, times = 10), pt_size = 1.5, pt_alpha = 1, lab_text_size = 1.25, axis_text_size = 1, leg_pos = \"bottomleft\", leg_cont = unique(groupcol) )"},{"path":"https://njlyon0.github.io/supportR/reference/pcoa_ord.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Publication-Quality Principal Coordinates Analysis (PCoA) Ordinations — pcoa_ord","text":"mod (pcoa) object returned ape::pcoa groupcol (dataframe) column specification data includes groups (accepts either bracket $ notation) title (character) string use title plot colors (character) vector colors (hexadecimal codes) length >= group levels (default colorblind safe need 10 built-unique colors) shapes (numeric) vector shapes (values accepted pch) length >= group levels lines (numeric) vector line types (integers) length >= group levels pt_size (numeric) value point size (controlled character expansion .e., cex) pt_alpha (numeric) value transparency points (ranges 0 1) lab_text_size (numeric) value axis label text size axis_text_size (numeric) value axis tick text size leg_pos (character numeric) legend position, either numeric vector x/y coordinates shorthand accepted graphics::legend leg_cont (character) vector desired legend entries. Defaults unique entries groupcol argument (argument provided case syntax legend contents differ data contents)","code":""},{"path":"https://njlyon0.github.io/supportR/reference/pcoa_ord.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Publication-Quality Principal Coordinates Analysis (PCoA) Ordinations — pcoa_ord","text":"(plot) base R ordination ellipse group","code":""},{"path":"https://njlyon0.github.io/supportR/reference/pcoa_ord.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Publication-Quality Principal Coordinates Analysis (PCoA) Ordinations — pcoa_ord","text":"","code":"# \\donttest{ # Use data from the vegan package data(\"varespec\", package = 'vegan') resp <- varespec # Make some columns of known number of groups factor_4lvl <- c(rep.int(\"Trt1\", (nrow(resp)/4)), rep.int(\"Trt2\", (nrow(resp)/4)), rep.int(\"Trt3\", (nrow(resp)/4)), rep.int(\"Trt4\", (nrow(resp)/4))) # And combine them into a single data object data <- cbind(factor_4lvl, resp) # Get a distance matrix from the data dist <- vegan::vegdist(resp, method = 'kulczynski') # Perform a PCoA on the distance matrix to get points for an ordination pnts <- ape::pcoa(dist) # Test the function for 4 groups pcoa_ord(mod = pnts, groupcol = data$factor_4lvl) # }"},{"path":"https://njlyon0.github.io/supportR/reference/replace_non_ascii.html","id":null,"dir":"Reference","previous_headings":"","what":"Replace Non-ASCII Characters with Comparable ASCII Characters — replace_non_ascii","title":"Replace Non-ASCII Characters with Comparable ASCII Characters — replace_non_ascii","text":"Finds non-ASCII (American Standard Code Information Interchange) characters character vector replaces ASCII characters visually similar possible. example, various special dash types (e.g., em dash, en dash, etc.) replaced hyphen. function return warning finds non-ASCII characters hard-coded replacement. Please open GitHub Issue encounter warning suggestion replacement character particular character.","code":""},{"path":"https://njlyon0.github.io/supportR/reference/replace_non_ascii.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Replace Non-ASCII Characters with Comparable ASCII Characters — replace_non_ascii","text":"","code":"replace_non_ascii(x = NULL, include_letters = FALSE)"},{"path":"https://njlyon0.github.io/supportR/reference/replace_non_ascii.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Replace Non-ASCII Characters with Comparable ASCII Characters — replace_non_ascii","text":"x (character) vector replace non-ASCII characters include_letters (logical) whether include letters accents (e.g., u umlaut, etc.). Defaults FALSE","code":""},{"path":"https://njlyon0.github.io/supportR/reference/replace_non_ascii.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Replace Non-ASCII Characters with Comparable ASCII Characters — replace_non_ascii","text":"(character) vector non-ASCII characters replaced ASCII equivalents","code":""},{"path":"https://njlyon0.github.io/supportR/reference/replace_non_ascii.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Replace Non-ASCII Characters with Comparable ASCII Characters — replace_non_ascii","text":"","code":"# Make a vector of the hexadecimal codes for several non-ASCII characters ## This function accepts the characters themselves but CRAN checks do not non_ascii <- c(\"\\u201C\", \"\\u00AC\", \"\\u00D7\") # Invoke function (ascii <- replace_non_ascii(x = non_ascii)) #> [1] \"\\\"\" \"-\" \"x\""},{"path":"https://njlyon0.github.io/supportR/reference/rmd_export.html","id":null,"dir":"Reference","previous_headings":"","what":"Knit an R Markdown File and Export to Google Drive — rmd_export","title":"Knit an R Markdown File and Export to Google Drive — rmd_export","text":"function allows knit specified R Markdown file locally export Google Drive folder provided link. NOTE used googledrive::drive_auth prompt authorize Google account new browser tab. check box screen continuing able use function clear browser cache re-authenticate. recommend invoking drive_auth beforehand reduce chances error","code":""},{"path":"https://njlyon0.github.io/supportR/reference/rmd_export.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Knit an R Markdown File and Export to Google Drive — rmd_export","text":"","code":"rmd_export( rmd = NULL, out_path = getwd(), out_name = NULL, out_type = \"html\", drive_link )"},{"path":"https://njlyon0.github.io/supportR/reference/rmd_export.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Knit an R Markdown File and Export to Google Drive — rmd_export","text":"rmd (character) name path R markdown file knit out_path (character) path knit file's destination (defaults path returned getwd()) out_name (character) desired name knit file (without file suffix) out_type (character) either \"html\" \"pdf\" depending YAML entry output: field R Markdown file drive_link (character) full URL drive folder upload knit document","code":""},{"path":"https://njlyon0.github.io/supportR/reference/rmd_export.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Knit an R Markdown File and Export to Google Drive — rmd_export","text":"return value, called knit R Markdown file","code":""},{"path":"https://njlyon0.github.io/supportR/reference/rmd_export.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Knit an R Markdown File and Export to Google Drive — rmd_export","text":"","code":"if (FALSE) { # \\dontrun{ # Authorize R to interact with GoogleDrive googledrive::drive_auth() ## NOTE: See warning about possible misstep at this stage # Use `rmd_export()` to knit and export an .Rmd file rmd_export(rmd = \"my_markdown.Rmd\", in_path = getwd(), out_path = getwd(), out_name = \"my_markdown\", out_type = \"html\", drive_link = \"\") } # }"},{"path":"https://njlyon0.github.io/supportR/reference/safe_rename.html","id":null,"dir":"Reference","previous_headings":"","what":"Safely Rename Columns in a Dataframe — safe_rename","title":"Safely Rename Columns in a Dataframe — safe_rename","text":"Replaces specified column names user-defined vector new column name(s). operation done \"safely\" specifically matches 'bad' name corresponding 'good' name thus minimizes risk accidentally replacing wrong column name.","code":""},{"path":"https://njlyon0.github.io/supportR/reference/safe_rename.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Safely Rename Columns in a Dataframe — safe_rename","text":"","code":"safe_rename(data = NULL, bad_names = NULL, good_names = NULL)"},{"path":"https://njlyon0.github.io/supportR/reference/safe_rename.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Safely Rename Columns in a Dataframe — safe_rename","text":"data (dataframe dataframe-like) object column names match values passed bad_names argument bad_names (character) vector column names replace original data object. Order need match data column order must match good_names vector order good_names (character) vector column names use replacements data object. Order need match data column order must match good_names vector order","code":""},{"path":"https://njlyon0.github.io/supportR/reference/safe_rename.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Safely Rename Columns in a Dataframe — safe_rename","text":"(dataframe dataframe-like) renamed columns","code":""},{"path":"https://njlyon0.github.io/supportR/reference/safe_rename.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Safely Rename Columns in a Dataframe — safe_rename","text":"","code":"# Make a dataframe to demonstrate df <- data.frame(\"first\" = 1:3, \"middle\" = 4:6, \"second\" = 7:9) # Invoke the function safe_rename(data = df, bad_names = c(\"second\", \"middle\"), good_names = c(\"third\", \"second\")) #> first second third #> 1 1 4 7 #> 2 2 5 8 #> 3 3 6 9"},{"path":"https://njlyon0.github.io/supportR/reference/summary_table.html","id":null,"dir":"Reference","previous_headings":"","what":"Generate Summary Table for Supplied Response and Grouping Variables — summary_table","title":"Generate Summary Table for Supplied Response and Grouping Variables — summary_table","text":"Calculates mean, standard deviation, sample size, standard error given response variable within user-defined grouping variables. meant convenience instead dplyr::group_by followed dplyr::summarize iteratively .","code":""},{"path":"https://njlyon0.github.io/supportR/reference/summary_table.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Generate Summary Table for Supplied Response and Grouping Variables — summary_table","text":"","code":"summary_table( data = NULL, groups = NULL, response = NULL, drop_na = FALSE, round_digits = 2 )"},{"path":"https://njlyon0.github.io/supportR/reference/summary_table.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Generate Summary Table for Supplied Response and Grouping Variables — summary_table","text":"data (dataframe dataframe-like) object column names match values passed groups response arguments groups (character) vector column names group response (character) name column name calculate summary statistics (column must numeric) drop_na (logical) whether drop NAs grouping variables. Defaults FALSE round_digits (numeric) number digits mean, standard deviation, standard error rounded","code":""},{"path":"https://njlyon0.github.io/supportR/reference/summary_table.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Generate Summary Table for Supplied Response and Grouping Variables — summary_table","text":"(dataframe) summary table containing mean, standard deviation, sample size, standard error supplied response variable","code":""},{"path":"https://njlyon0.github.io/supportR/reference/supportR-package.html","id":null,"dir":"Reference","previous_headings":"","what":"supportR: Support Functions for Wrangling and Visualization — supportR-package","title":"supportR: Support Functions for Wrangling and Visualization — supportR-package","text":"Suite helper functions data wrangling visualization. theme functions tend towards simple, short, narrowly-scoped. functions built tasks often recur large enough scope warrant ecosystem interdependent functions.","code":""},{"path":[]},{"path":"https://njlyon0.github.io/supportR/reference/supportR-package.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"supportR: Support Functions for Wrangling and Visualization — supportR-package","text":"Maintainer: Nicholas J Lyon njlyon@alumni.iastate.edu (ORCID) [copyright holder]","code":""},{"path":"https://njlyon0.github.io/supportR/reference/tabularize_md.html","id":null,"dir":"Reference","previous_headings":"","what":"Make a Markdown File into a Table — tabularize_md","title":"Make a Markdown File into a Table — tabularize_md","text":"Accepts one markdown file (.e., \"md\" file extension) returns content table. Nested heading structure markdown file–defined hashtags / pounds signs (#)–identified preserved columns resulting tabular format. line non-heading content file preserved right-column one row table.","code":""},{"path":"https://njlyon0.github.io/supportR/reference/tabularize_md.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Make a Markdown File into a Table — tabularize_md","text":"","code":"tabularize_md(file = NULL)"},{"path":"https://njlyon0.github.io/supportR/reference/tabularize_md.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Make a Markdown File into a Table — tabularize_md","text":"file (character/url connection) name file path markdown file transform table connection object URL markdown file (see ?base::url details)","code":""},{"path":"https://njlyon0.github.io/supportR/reference/tabularize_md.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Make a Markdown File into a Table — tabularize_md","text":"(dataframe) table one additional column heading levels document (e.g., first second level headings document, resulting table three columns) one row per line non-heading content markdown file.","code":""},{"path":"https://njlyon0.github.io/supportR/reference/tabularize_md.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Make a Markdown File into a Table — tabularize_md","text":"","code":"if (FALSE) { # \\dontrun{ # Identify URL to the NEWS.md file in `supportR` GitHub repo md_cxn <- url(\"https://raw.githubusercontent.com/njlyon0/supportR/main/NEWS.md\") # Transform it into a table md_df <- tabularize_md(file = md_cxn) # Close connection (just good housekeeping to do so) close(md_cxn) # Check out the table format str(md_df) } # }"},{"path":"https://njlyon0.github.io/supportR/reference/theme_lyon.html","id":null,"dir":"Reference","previous_headings":"","what":"Complete ggplot2 Theme for Non-Data Aesthetics — theme_lyon","title":"Complete ggplot2 Theme for Non-Data Aesthetics — theme_lyon","text":"Custom alternative ggtheme options built ggplot2. Removes gray boxes grid lines plot background. Increases font size tick marks axis labels. Removes gray box legend background legend key. Removes legend title.","code":""},{"path":"https://njlyon0.github.io/supportR/reference/theme_lyon.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Complete ggplot2 Theme for Non-Data Aesthetics — theme_lyon","text":"","code":"theme_lyon(title_size = 16, text_size = 13)"},{"path":"https://njlyon0.github.io/supportR/reference/theme_lyon.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Complete ggplot2 Theme for Non-Data Aesthetics — theme_lyon","text":"title_size (numeric) size font axis titles text_size (numeric) size font tick labels","code":""},{"path":"https://njlyon0.github.io/supportR/reference/theme_lyon.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Complete ggplot2 Theme for Non-Data Aesthetics — theme_lyon","text":"(ggplot theme) list ggplot2 theme elements","code":""},{"path":"https://njlyon0.github.io/supportR/news/index.html","id":"supportr-version-140900","dir":"Changelog","previous_headings":"","what":"supportR Version 1.4.0.900","title":"supportR Version 1.4.0.900","text":"Development version, changes preceding version listed : changes (yet)","code":""},{"path":"https://njlyon0.github.io/supportR/news/index.html","id":"supportr-version-140","dir":"Changelog","previous_headings":"","what":"supportR Version 1.4.0","title":"supportR Version 1.4.0","text":"CRAN release: 2024-06-13 Changes preceding version listed New function: replace_non_ascii. Replaces non-ASCII characters ASCII characters visually similar possible New function: count. Counts occurrences unique element provided vector New function: ordination. Generic function creates either NMS PCoA ordinations. Makes extensive use ... argument greatly increase level control user can expect internal base R graphing functions. Supersedes nms_ord pcoa_ord. Superseded functions: nms_ord pcoa_ord now superseded special cases ordination New function behavior: nms_ord pcoa_ord now support modifying axis label text size axis tickmark text size Began process adding units tests functions package. Users may notice small cases informative errors/warnings returned generally shouldn’t change function behavior appreciable way","code":""},{"path":"https://njlyon0.github.io/supportR/news/index.html","id":"supportr-version-130","dir":"Changelog","previous_headings":"","what":"supportR Version 1.3.0","title":"supportR Version 1.3.0","text":"CRAN release: 2024-04-12 Changes preceding version listed New function: force_num. Coerces vector numeric automatically silences warnings due coercing values NA New function: safe_rename. Renames columns given dataframe matching ‘bad’ names ‘good’ names New function: tabularize_md. Converts markdown file table retains nested structure headings file","code":""},{"path":"https://njlyon0.github.io/supportR/news/index.html","id":"supportr-version-120","dir":"Changelog","previous_headings":"","what":"supportR Version 1.2.0","title":"supportR Version 1.2.0","text":"CRAN release: 2023-08-22 Changes preceding version listed New function: name_vec. Creates named vector specified contents names github_tree now supports excluding directories folder tree (default behavior now) New function behavior: num_check now accepts multiple column names/numbers col argument New function behavior: date_check now accepts multiple column names/numbers col argument Deprecated function: multi_num_check now deprecated (warning) special case num_check Deprecated function: multi_date_check now deprecated (warning) special case date_check","code":""},{"path":"https://njlyon0.github.io/supportR/news/index.html","id":"supportr-version-110","dir":"Changelog","previous_headings":"","what":"supportR Version 1.1.0","title":"supportR Version 1.1.0","text":"CRAN release: 2023-07-08 Changes preceding version listed New function: github_ls. Lists contents specified GitHub repository either recursively top-level/specified folder New function: github_tree. Creates file tree diagram specified GitHub repository Refined clarified package vignette pcoa_ord nms_ord now include arguments changing point size (pt_size) opacity (pt_alpha; .e., transparency). Changes point size reflected legend changes opacity reflected legend points Fixed typo message returned diff_check Added example documentation crop_tri","code":""},{"path":"https://njlyon0.github.io/supportR/news/index.html","id":"supportr-version-100","dir":"Changelog","previous_headings":"","what":"supportR Version 1.0.0","title":"supportR Version 1.0.0","text":"CRAN release: 2023-02-09 first fully-functioning version package. currently ERRORs, WARNINGs, NOTEs devtools::check","code":""}] +[{"path":"https://njlyon0.github.io/supportR/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2023 supportR 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://njlyon0.github.io/supportR/articles/supportR.html","id":"overview","dir":"Articles","previous_headings":"","what":"Overview","title":"supportR Vignette","text":"supportR package amalgam distinct functions ’ve written accomplish small data wrangling, quality control, visualization tasks. functions tend short narrowly-defined. additional consequence motivation creating tend inter-related united common theme. vignette feels somewhat scattered , hope doesn’t negatively affect informative willingness adopt supportR scripts! vignette describes main functions supportR using examples included function.","code":"#install.packages(\"supportR\") library(supportR)"},{"path":"https://njlyon0.github.io/supportR/articles/supportR.html","id":"data-wrangling","dir":"Articles","previous_headings":"Overview","what":"Data Wrangling","title":"supportR Vignette","text":"order demonstrate data wrangling functions supportR, ’ll use example data Dr. Allison Horst’s palmerpenguins R package. data loaded, can use summary_table function quickly get group-wise summaries retrieve generally useful summary statistics. groups argument supports vector column names group response must single numeric column. drop_na argument allows group combinations result NA automatically dropped (.e., penguin didn’t island listed dropped). mean, standard deviation (SD), sample size, standard error (SE) returned facilitate easy figure creation. also round_digits argument lets specify many digits ’d like retain mean, SD, SE. safe_rename function allows–perhaps predictably–“safe” renaming column names given data object. ‘bad’ column names corresponding ‘good’ names must specified. order entries two vectors must match (.e., first bad name replaced first good name), order need match order occur data! crop_tri allows dropping one “triangle” symmetric dataframe / matrix. also includes drop_diag argument accepts logical whether drop diagonal data object. primarily useful (find) allowing piping function opposed using base R notation removing triangle symmetric data object. array_melt allows users ‘melt’ array dimensions X, Y, Z dataframe containing columns “x”, “y”, “z”, “value” “value” whatever stored coordinates array.","code":"# Check the structure of the penguins dataset str(penguins) #> 'data.frame': 344 obs. of 8 variables: #> $ species : Factor w/ 3 levels \"Adelie\",\"Chinstrap\",..: 1 1 1 1 1 1 1 1 1 1 ... #> $ island : Factor w/ 3 levels \"Biscoe\",\"Dream\",..: 3 3 3 3 3 3 3 3 3 3 ... #> $ bill_length_mm : num 39.1 39.5 40.3 NA 36.7 39.3 38.9 39.2 34.1 42 ... #> $ bill_depth_mm : num 18.7 17.4 18 NA 19.3 20.6 17.8 19.6 18.1 20.2 ... #> $ flipper_length_mm: int 181 186 195 NA 193 190 181 195 193 190 ... #> $ body_mass_g : int 3750 3800 3250 NA 3450 3650 3625 4675 3475 4250 ... #> $ sex : Factor w/ 2 levels \"female\",\"male\": 2 1 1 NA 1 2 1 2 NA NA ... #> $ year : int 2007 2007 2007 2007 2007 2007 2007 2007 2007 2007 ... # Summarize the data supportR::summary_table(data = penguins, groups = c(\"species\", \"island\"), response = \"bill_length_mm\", drop_na = TRUE) #> species island mean std_dev sample_size std_error #> 1 Adelie Biscoe 38.98 2.48 44 0.37 #> 2 Adelie Dream 38.50 2.47 56 0.33 #> 3 Adelie Torgersen 38.95 3.03 52 0.42 #> 4 Chinstrap Dream 48.83 3.34 68 0.41 #> 5 Gentoo Biscoe 47.50 3.08 124 0.28 # Make a dataframe to demonstrate df <- data.frame(\"first\" = 1:3, \"middle\" = 4:6, \"second\" = 7:9) # Invoke the function safe_rename(data = df, bad_names = c(\"second\", \"middle\"), good_names = c(\"third\", \"second\")) #> first second third #> 1 1 4 7 #> 2 2 5 8 #> 3 3 6 9 # Define a simple matrix wtih symmetric dimensions mat <- matrix(data = c(1:2, 2:1), nrow = 2, ncol = 2) # Crop off it's lower triangle supportR::crop_tri(data = mat, drop_tri = \"lower\", drop_diag = FALSE) #> [,1] [,2] #> [1,] 1 2 #> [2,] NA 1 # Drop the diagonal as well supportR::crop_tri(data = mat, drop_tri = \"lower\", drop_diag = TRUE) #> [,1] [,2] #> [1,] NA 2 #> [2,] NA NA # Make data to fill the array vec1 <- c(5, 9, 3) vec2 <- c(10:15) # Create dimension names (x = col, y = row, z = which matrix) x_vals <- c(\"Col_1\",\"Col_2\",\"Col_3\") y_vals <- c(\"Row_1\",\"Row_2\",\"Row_3\") z_vals <- c(\"Mat_1\",\"Mat_2\") # Make an array from these components g <- array(data = c(vec1, vec2), dim = c(3, 3, 2), dimnames = list(x_vals, y_vals, z_vals)) # \"Melt\" the array into a dataframe melted <- supportR::array_melt(array = g) # Look at that top of that head(melted) #> z y x value #> 1 Mat_1 Col_1 Row_1 5 #> 2 Mat_1 Col_1 Row_2 10 #> 3 Mat_1 Col_1 Row_3 13 #> 4 Mat_1 Col_2 Row_1 9 #> 5 Mat_1 Col_2 Row_2 11 #> 6 Mat_1 Col_2 Row_3 14"},{"path":"https://njlyon0.github.io/supportR/articles/supportR.html","id":"quality-control","dir":"Articles","previous_headings":"Overview","what":"Quality Control","title":"supportR Vignette","text":"terms quality control functions, diff_check compares two vectors reports back first second (.e., “lost”) second first (.e., “gained”). find useful () comparing index columns two data objects intend join together (B) ensure columns unintentionally removed lengthy tidyverse-style pipes (%>%). diff_check also includes optional logical arguments sort return respectively either sort difference vectors return two-element set TRUE. package also includes function num_check identifies values column coerced NA .numeric run column. non-numbers identified can handle whatever way feel appropriate. num_check intended flag attention, attempt fix using method may may support. date_check similar operation checking column entries coerced NA .Date instead. Note date sufficiently badly formatted .Date throw error instead coercing NA date_check thing. num_check date_check can accept multiple column names col argument (version 1.1.1) columns checked separately. Another date column quality control function date_format_guess. function checks column dates (stored characters!) tries guess format date (.e., month/day/year, day/month/year, etc.). can make informed guess grouping column can use frequency “date” entries within groups guess whether given number day month. based assumption sampling occurs often within months across number occurs rows within grouping values likely month. Recognizing assumption may uncomfortable users, groups argument can set FALSE clearer judgment calls (.e., number >12 day, etc.). Note dates guessed function return “FORMAT UNCERTAIN” can handle using knowledge system (returning raw data need ).","code":"# Make two vectors vec1 <- c(\"x\", \"a\", \"b\") vec2 <- c(\"y\", \"z\", \"a\") # Compare them! supportR::diff_check(old = vec1, new = vec2, sort = TRUE, return = TRUE) #> Following element(s) found in old object but not new: #> [1] \"b\" \"x\" #> Following element(s) found in new object but not old: #> [1] \"y\" \"z\" #> $lost #> [1] \"b\" \"x\" #> #> $gained #> [1] \"y\" \"z\" # Make a dataframe with non-numbers in a number column fish <- data.frame(\"species\" = c(\"salmon\", \"bass\", \"halibut\", \"eel\"), \"count\" = c(1, \"14x\", \"_23\", 12)) # Use `num_check` to identify non-numbers num_check(data = fish, col = \"count\") #> For 'count', 2 non-numbers identified: '14x' | '_23' #> $count #> [1] \"14x\" \"_23\" # Make a dataframe including malformed dates sites <- data.frame(\"site\" = c(\"LTR\", \"GIL\", \"PYN\", \"RIN\"), \"visit\" = c(\"2021-01-01\", \"2021-01-0w\", \"1990\", \"2020-10-xx\")) # Now we can use our function to identify bad dates supportR::date_check(data = sites, col = \"visit\") #> For 'visit', 3 non-dates identified: '2021-01-0w' | '1990' | '2020-10-xx' #> $visit #> [1] \"2021-01-0w\" \"1990\" \"2020-10-xx\" # Make a dataframe with dates in various formats and a grouping column my_df <- data.frame(\"data_enterer\" = c(\"person A\", \"person B\", \"person B\", \"person B\", \"person C\", \"person D\", \"person E\", \"person F\", \"person G\"), \"bad_dates\" = c(\"2022.13.08\", \"2021/2/02\", \"2021/2/03\", \"2021/2/04\", \"1899/1/15\", \"10-31-1901\", \"26/11/1901\", \"08.11.2004\", \"6/10/02\")) # Now we can invoke the function! supportR::date_format_guess(data = my_df, date_col = \"bad_dates\", group_col = \"data_enterer\", return = \"dataframe\") #> Returning dataframe of data format guesses #> data_enterer bad_dates format_guess #> 1 person A 2022.13.08 year/day/month #> 2 person B 2021/2/02 year/month/day #> 3 person B 2021/2/03 year/month/day #> 4 person B 2021/2/04 year/month/day #> 5 person C 1899/1/15 year/month/day #> 6 person D 10-31-1901 month/day/year #> 7 person E 26/11/1901 day/month/year #> 8 person F 08.11.2004 FORMAT UNCERTAIN #> 9 person G 6/10/02 FORMAT UNCERTAIN # If preferred, do it without groups and return a vector supportR::date_format_guess(data = my_df, date_col = \"bad_dates\", groups = FALSE, return = \"vector\") #> Defining 'groups' is strongly recommended! If none exist, consider adding a single artificial group shared by all rows then re-run this function #> Returning vector of data format guesses #> [1] \"year/day/month\" \"FORMAT UNCERTAIN\" \"FORMAT UNCERTAIN\" \"FORMAT UNCERTAIN\" #> [5] \"year/month/day\" \"month/day/year\" \"day/month/year\" \"FORMAT UNCERTAIN\" #> [9] \"FORMAT UNCERTAIN\""},{"path":"https://njlyon0.github.io/supportR/articles/supportR.html","id":"data-visualization","dir":"Articles","previous_headings":"Overview","what":"Data Visualization","title":"supportR Vignette","text":"’ve created set custom ggplot2 theme elements guarantee figures share similar aesthetics. Feel free use theme_lyon similar preferences! theme_lyon following changes ggplot2 plot: Removes legend title background Removes gray box behind colors legend elements Removes major/minor gridlines Makes axes’ lines black Increases font size axes titles tick labels ’ve also created ordination Nonmetric Multidimensional Scaling (NMS) Principal Coordinates Analysis (PCoA) ordinations. Note function requires multidimensional scaling object created either ape::pcoa vegan::metaMDS.","code":"# Load ggplot2 library(ggplot2) # Create a plot and allow default ggplot themeing to be added ggplot(penguins, aes(x = species, y = body_mass_g, fill = species)) + geom_boxplot(outlier.shape = 24) # Compare with the same plot with my theme ggplot(penguins, aes(x = species, y = body_mass_g, fill = species)) + geom_boxplot(outlier.shape = 24) + supportR::theme_lyon() # Load data from the `vegan` package utils::data(\"varespec\", package = \"vegan\") # Make a columns to split the data into 4 groups treatment <- c(rep.int(\"Trt_1\", (nrow(varespec)/4)), rep.int(\"Trt_2\", (nrow(varespec)/4)), rep.int(\"Trt_3\", (nrow(varespec)/4)), rep.int(\"Trt_4\", (nrow(varespec)/4))) # And combine them into a single data object data <- cbind(treatment, varespec) # Actually perform multidimensional scaling mds <- vegan::metaMDS(data[-1], autotransform = FALSE, expand = FALSE, k = 2, try = 10) # With the scaled object and original dataframe we can use this function ordination(mod = mds, grps = data$treatment, x = \"bottomright\", legend = paste0(\"Treat-\", 1:4))"},{"path":"https://njlyon0.github.io/supportR/articles/supportR.html","id":"operations-outside-of-r","dir":"Articles","previous_headings":"Overview","what":"Operations Outside of R","title":"supportR Vignette","text":"Finally, ’ve written several functions allow interact APIs outside R via R functions hopefully comfortable syntax. functions rely user credentials, run non-interactively (CRAN submission) following code chunks evaluated included examples proper syntax reference.","code":""},{"path":"https://njlyon0.github.io/supportR/articles/supportR.html","id":"github-related-functions","dir":"Articles","previous_headings":"Overview > Operations Outside of R","what":"GitHub-Related Functions","title":"supportR Vignette","text":"GitHub users, ’ve developed two related functions: github_ls github_tree. github_ls accepts URL GitHub repository access (public private). creates dataframe repository’s contents including names, types, full paths within repository. Listing particular folder recursive listing nested subfolders within repository supported via additional arguments. folder argument set NULL (default) top level repository listed. github_tree extension github_ls identifies files repository creates file tree diagram folder structure simple human-readable. Unlike github_ls, github_tree supports recursive identification files beginning top level repository. however allow users exclude listings particular folders specifying names exclude argument. think particularly useful embed repository’s README.Rmd create quick--easy file map visitors use guide navigating repository’s contents.","code":"# List all files in a GitHub repository supportR::github_ls(repo = \"https://github.com/njlyon0/supportR\", recursive = TRUE, quiet = FALSE) # Or list files in only a particular folder supportR::github_ls(repo = \"https://github.com/njlyon0/supportR\", folder = \"R\", recursive = FALSE, quiet = TRUE) # Create a file tree diagram of a GitHub repository supportR::github_tree(repo = repo = \"https://github.com/njlyon0/supportR\", exclude = c(\"docs\", \"man\", \".github\"), quiet = FALSE)"},{"path":"https://njlyon0.github.io/supportR/articles/supportR.html","id":"external-file-related-functions","dir":"Articles","previous_headings":"Overview > Operations Outside of R","what":"External File-Related Functions","title":"supportR Vignette","text":"Valuable information sometimes stored markdown files –consistently formatted internally–always easily parsed R. ’ve written tabularize_md ingest markdown file collapse table still preserving nested structure headings may source file. function accepts either local markdown file name/path connection (via URL) online markdown file. ’ll demonstrate URL-based variant use local file need provide file name/path reading function (e.g., read.csv, etc.)","code":"# Identify URL to the NEWS.md file in `supportR` GitHub repo md_cxn <- url(\"https://raw.githubusercontent.com/njlyon0/supportR/main/NEWS.md\") # Transform it into a table md_df <- tabularize_md(file = md_cxn) # Close connection (just good housekeeping to do so) close(md_cxn) # Check out the table format str(md_df)"},{"path":"https://njlyon0.github.io/supportR/articles/supportR.html","id":"google-drive-related-functions","dir":"Articles","previous_headings":"Overview > Operations Outside of R","what":"Google Drive-Related Functions","title":"supportR Vignette","text":"users create RMarkdown reports want store Google Drive folder, rmd_export knits exports given R Markdown file locally user-designated Google Drive folder. Note MUST authenticate R session googledrive package permission access Drive folder supply. recommend running googledrive::drive_auth() authentication “dance” browser using rmd_export reduce chances errors.","code":"# Authorize R to interact with GoogleDrive googledrive::drive_auth() # Use `rmd_export()` to knit and export an .Rmd file supportR::rmd_export(rmd = \"my_markdown.Rmd\", in_path = file.path(\"Folder in my WD with the .Rmd named in `rmd`\"), out_path = file.path(\"Folder in my WD to save the knit file to\"), out_name = \"desired name for output\", out_type = \"html\", drive_link = \"\")"},{"path":"https://njlyon0.github.io/supportR/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Nicholas J Lyon. Author, maintainer, copyright holder.","code":""},{"path":"https://njlyon0.github.io/supportR/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Lyon N (2024). supportR: Support Functions Wrangling Visualization. R package version 1.4.0.900, https://njlyon0.github.io/supportR/, https://github.com/njlyon0/supportR.","code":"@Manual{, title = {supportR: Support Functions for Wrangling and Visualization}, author = {Nicholas J Lyon}, year = {2024}, note = {R package version 1.4.0.900, https://njlyon0.github.io/supportR/}, url = {https://github.com/njlyon0/supportR}, }"},{"path":"https://njlyon0.github.io/supportR/index.html","id":"supportr---support-functions-for-wrangling-and-visualization","dir":"","previous_headings":"","what":"Support Functions for Wrangling and Visualization","title":"Support Functions for Wrangling and Visualization","text":"supportR R package unifying theme functions honestly just wrote . said, useful functions data wrangling plotting particular, though functions purposes also included. ’ll add functions package write orphan scripts hope others might find useful stay tuned!","code":""},{"path":"https://njlyon0.github.io/supportR/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Support Functions for Wrangling and Visualization","text":"can install development version GitHub :","code":"# install.packages(\"devtools\") devtools::install_github(\"njlyon0/supportR\")"},{"path":"https://njlyon0.github.io/supportR/index.html","id":"data-wrangling","dir":"","previous_headings":"Installation","what":"Data Wrangling","title":"Support Functions for Wrangling and Visualization","text":"summary_table: Calculates summary values (mean, standard deviation, sample size, standard error) given response variable within supplied groups safe_rename: Renames columns given dataframe matching ‘bad’ names ‘good’ names name_vec: Creates named vector specified contents names. Useful creating named vectors long create manually creating vector naming cumbersome crop_tri: Removes specified “triangle” (either upper lower) symmetric data object replacing NAs. Also allows user specify whether keep also drop diagonal array_melt: “Flattens” array dimensions X, Y, Z dataframe containing columns x, y, z, value value whatever stored array coordinates","code":""},{"path":"https://njlyon0.github.io/supportR/index.html","id":"quality-control-qc","dir":"","previous_headings":"Installation","what":"Quality Control (QC)","title":"Support Functions for Wrangling and Visualization","text":"diff_check: Compares two vectors identifies elements found first second (.e., lost components) elements found second first (.e., gained components). Extremely useful prior joining two dataframes compare index column contents ensure columns unexpectedly lost complex wrangling operations num_check: Checks column(s) contain numeric values entries coerced NA .numeric run count: Counts instances unique element provided vector date_check: Checks column(s) contain date values entries coerced NA .Date run date_format_guess: Checks column containing multiple ambiguous date formats identifies best guess format date (e.g., ‘dd/mm/yyyy’ versus ‘yyyy/dd/mm’, etc.)","code":""},{"path":"https://njlyon0.github.io/supportR/index.html","id":"visualization--graphics","dir":"","previous_headings":"Installation","what":"Visualization & Graphics","title":"Support Functions for Wrangling and Visualization","text":"theme_lyon: Applies set modifications non-data aspects ggplot2 plot ensure consistent “feel” set plots ordination: Creates ordination either nonmetric multidimensional scaling (NMS) dissimilarity matrix created vegan::metaMDS principal coordinates analysis (PCoA) distance matrix returned ape::pcoa","code":""},{"path":"https://njlyon0.github.io/supportR/index.html","id":"operations-outside-of-r","dir":"","previous_headings":"Installation","what":"Operations Outside of R","title":"Support Functions for Wrangling and Visualization","text":"github_ls: Lists contents GitHub repository URL returns simple dataframe containing name, type, file path identified objects. Supports recursive listing (.e., listing contents subfolders identified first list contents) github_tree: Creates file tree diagram GitHub repository URL tabularize_md: Converts markdown file table retains nested structure headings file. Accepts either file name/path locally URL connection markdown file hosted online (e.g., GitHub repository README.md, etc.) rmd_export: Allows knitting specified R Markdown file locally simultaneously specified Google Drive folder. NOTE: must authorize R work Google Drive using googldrive::drive_auth() function work","code":""},{"path":"https://njlyon0.github.io/supportR/index.html","id":"looking-ahead","dir":"","previous_headings":"","what":"Looking Ahead","title":"Support Functions for Wrangling and Visualization","text":"functions likely developed housed within package stay tuned! Feel free post ideas new functions issue repository ’ll best build !","code":""},{"path":"https://njlyon0.github.io/supportR/reference/array_melt.html","id":null,"dir":"Reference","previous_headings":"","what":"Melt an Array into a Dataframe — array_melt","title":"Melt an Array into a Dataframe — array_melt","text":"Melts array dimensions x, y, z dataframe containing columns x, y, z, value value whatever stored array coordinates.","code":""},{"path":"https://njlyon0.github.io/supportR/reference/array_melt.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Melt an Array into a Dataframe — array_melt","text":"","code":"array_melt(array = NULL)"},{"path":"https://njlyon0.github.io/supportR/reference/array_melt.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Melt an Array into a Dataframe — array_melt","text":"array (array) array object melt dataframe","code":""},{"path":"https://njlyon0.github.io/supportR/reference/array_melt.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Melt an Array into a Dataframe — array_melt","text":"(dataframe) object containing \"flattened\" array dataframe format","code":""},{"path":"https://njlyon0.github.io/supportR/reference/array_melt.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Melt an Array into a Dataframe — array_melt","text":"","code":"# First we need to create an array to melt ## Make data to fill the array vec1 <- c(5, 9, 3) vec2 <- c(10:15) ## Create dimension names (x = col, y = row, z = which matrix) x_vals <- c(\"Col_1\",\"Col_2\",\"Col_3\") y_vals <- c(\"Row_1\",\"Row_2\",\"Row_3\") z_vals <- c(\"Mat_1\",\"Mat_2\") ## Make an array from these components g <- array(data = c(vec1, vec2), dim = c(3, 3, 2), dimnames = list(x_vals, y_vals, z_vals)) ## \"Melt\" the array into a dataframe array_melt(array = g) #> z y x value #> 1 Mat_1 Col_1 Row_1 5 #> 2 Mat_1 Col_1 Row_2 10 #> 3 Mat_1 Col_1 Row_3 13 #> 4 Mat_1 Col_2 Row_1 9 #> 5 Mat_1 Col_2 Row_2 11 #> 6 Mat_1 Col_2 Row_3 14 #> 7 Mat_1 Col_3 Row_1 3 #> 8 Mat_1 Col_3 Row_2 12 #> 9 Mat_1 Col_3 Row_3 15 #> 10 Mat_2 Col_1 Row_1 5 #> 11 Mat_2 Col_1 Row_2 10 #> 12 Mat_2 Col_1 Row_3 13 #> 13 Mat_2 Col_2 Row_1 9 #> 14 Mat_2 Col_2 Row_2 11 #> 15 Mat_2 Col_2 Row_3 14 #> 16 Mat_2 Col_3 Row_1 3 #> 17 Mat_2 Col_3 Row_2 12 #> 18 Mat_2 Col_3 Row_3 15"},{"path":"https://njlyon0.github.io/supportR/reference/count.html","id":null,"dir":"Reference","previous_headings":"","what":"Count Occurrences of Unique Vector Elements — count","title":"Count Occurrences of Unique Vector Elements — count","text":"Counts number occurrences element provided vector. Counting NAs addition non-NA values supported.","code":""},{"path":"https://njlyon0.github.io/supportR/reference/count.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Count Occurrences of Unique Vector Elements — count","text":"","code":"count(vec = NULL)"},{"path":"https://njlyon0.github.io/supportR/reference/count.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Count Occurrences of Unique Vector Elements — count","text":"vec (vector) vector containing elements count","code":""},{"path":"https://njlyon0.github.io/supportR/reference/count.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Count Occurrences of Unique Vector Elements — count","text":"(dataframe) two-column dataframe many rows unique elements provided vector. First column named \"value\" includes unique elements vector, second column named \"count\" includes number occurrences vector element.","code":""},{"path":"https://njlyon0.github.io/supportR/reference/count.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Count Occurrences of Unique Vector Elements — count","text":"","code":"# Count instances of vector elements count(vec = c(1, 1, NA, \"a\", 1, \"a\", NA, \"x\")) #> value count #> 1 1 3 #> 2 2 #> 3 a 2 #> 4 x 1"},{"path":"https://njlyon0.github.io/supportR/reference/crop_tri.html","id":null,"dir":"Reference","previous_headings":"","what":"Crop a Triangle from Data Object — crop_tri","title":"Crop a Triangle from Data Object — crop_tri","text":"Accepts symmetric data object replaces chosen triangle NAs. Also allows user choose whether keep drop diagonal data object","code":""},{"path":"https://njlyon0.github.io/supportR/reference/crop_tri.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Crop a Triangle from Data Object — crop_tri","text":"","code":"crop_tri(data = NULL, drop_tri = \"upper\", drop_diag = FALSE)"},{"path":"https://njlyon0.github.io/supportR/reference/crop_tri.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Crop a Triangle from Data Object — crop_tri","text":"data (dataframe, dataframe-like, matrix) symmetric data object remove one triangles drop_tri (character) triangle replace NAs, either \"upper\" \"lower\" drop_diag (logical) whether drop diagonal data object (defaults FALSE)","code":""},{"path":"https://njlyon0.github.io/supportR/reference/crop_tri.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Crop a Triangle from Data Object — crop_tri","text":"(dataframe dataframe-like) data object desired triangle removed either without diagonal","code":""},{"path":"https://njlyon0.github.io/supportR/reference/crop_tri.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Crop a Triangle from Data Object — crop_tri","text":"","code":"# Define a simple matrix wtih symmetric dimensions mat <- matrix(data = c(1:2, 2:1), nrow = 2, ncol = 2) # Crop off it's lower triangle supportR::crop_tri(data = mat, drop_tri = \"lower\", drop_diag = FALSE) #> [,1] [,2] #> [1,] 1 2 #> [2,] NA 1"},{"path":"https://njlyon0.github.io/supportR/reference/date_check.html","id":null,"dir":"Reference","previous_headings":"","what":"Check Columns for Non-Dates — date_check","title":"Check Columns for Non-Dates — date_check","text":"Identifies elements column(s) changed NA .Date used column(s). useful quickly identifying \"problem\" entries ostensibly date column(s) /read character.","code":""},{"path":"https://njlyon0.github.io/supportR/reference/date_check.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check Columns for Non-Dates — date_check","text":"","code":"date_check(data = NULL, col = NULL)"},{"path":"https://njlyon0.github.io/supportR/reference/date_check.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Check Columns for Non-Dates — date_check","text":"data (dataframe) object containing least one column supposed dates col (character numeric) name(s) column number(s) column(s) containing putative dates data object","code":""},{"path":"https://njlyon0.github.io/supportR/reference/date_check.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check Columns for Non-Dates — date_check","text":"(list) malformed dates supplied column separate list elements","code":""},{"path":"https://njlyon0.github.io/supportR/reference/date_check.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Check Columns for Non-Dates — date_check","text":"","code":"# Make a dataframe to test the function loc <- c(\"LTR\", \"GIL\", \"PYN\", \"RIN\") time <- c(\"2021-01-01\", \"2021-01-0w\", \"1990\", \"2020-10-xx\") time2 <- c(\"1880-08-08\", \"2021-01-02\", \"1992\", \"2049-11-01\") time3 <- c(\"2022-10-31\", \"tomorrow\", \"1993\", NA) # Assemble our vectors into a dataframe sites <- data.frame(\"site\" = loc, \"first_visit\" = time, \"second\" = time2, \"third\" = time3) # Use `date_check()` to return only the entries that would be lost date_check(data = sites, col = c(\"first_visit\", \"second\", \"third\")) #> For 'first_visit', 3 non-dates identified: '2021-01-0w' | '1990' | '2020-10-xx' #> For 'second', 1 non-dates identified: '1992' #> For 'third', 2 non-dates identified: 'tomorrow' | '1993' #> $first_visit #> [1] \"2021-01-0w\" \"1990\" \"2020-10-xx\" #> #> $second #> [1] \"1992\" #> #> $third #> [1] \"tomorrow\" \"1993\" #>"},{"path":"https://njlyon0.github.io/supportR/reference/date_format_guess.html","id":null,"dir":"Reference","previous_headings":"","what":"Identify Probable Format for Ambiguous Date Formats — date_format_guess","title":"Identify Probable Format for Ambiguous Date Formats — date_format_guess","text":"column containing multiple date formats (e.g., MM/DD/YYYY, \"YYYY/MM/DD, etc.) identifies probable format date. Provision grouping column improves inference. formats determined flagged \"FORMAT UNCERTAIN\" human double-checking. useful quickly sorting bulk ambiguous dates clear categories later conditional wrangling.","code":""},{"path":"https://njlyon0.github.io/supportR/reference/date_format_guess.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Identify Probable Format for Ambiguous Date Formats — date_format_guess","text":"","code":"date_format_guess( data = NULL, date_col = NULL, groups = TRUE, group_col = NULL, return = \"dataframe\", quiet = FALSE )"},{"path":"https://njlyon0.github.io/supportR/reference/date_format_guess.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Identify Probable Format for Ambiguous Date Formats — date_format_guess","text":"data (dataframe) object containing least one column ambiguous dates date_col (character) name column containing ambiguous dates groups (logical) whether groups exist dataframe / used (defaults TRUE) group_col (character) name column containing grouping variable return (character) either \"dataframe\" \"vector\" depending whether user wants date format \"guesses\" returned new column dataframe vector quiet (logical) whether certain optional messages displayed (defaults FALSE)","code":""},{"path":"https://njlyon0.github.io/supportR/reference/date_format_guess.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Identify Probable Format for Ambiguous Date Formats — date_format_guess","text":"(dataframe character) object containing date format guesses","code":""},{"path":"https://njlyon0.github.io/supportR/reference/date_format_guess.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Identify Probable Format for Ambiguous Date Formats — date_format_guess","text":"","code":"# Create dataframe of example ambiguous dates & grouping variable my_df <- data.frame('data_enterer' = c('person A', 'person B', 'person B', 'person B', 'person C', 'person D', 'person E', 'person F', 'person G'), 'bad_dates' = c('2022.13.08', '2021/2/02', '2021/2/03', '2021/2/04', '1899/1/15', '10-31-1901', '26/11/1901', '08.11.2004', '6/10/02')) # Now we can invoke the function! date_format_guess(data = my_df, date_col = \"bad_dates\", group_col = \"data_enterer\", return = \"dataframe\") #> Returning dataframe of data format guesses #> data_enterer bad_dates format_guess #> 1 person A 2022.13.08 year/day/month #> 2 person B 2021/2/02 year/month/day #> 3 person B 2021/2/03 year/month/day #> 4 person B 2021/2/04 year/month/day #> 5 person C 1899/1/15 year/month/day #> 6 person D 10-31-1901 month/day/year #> 7 person E 26/11/1901 day/month/year #> 8 person F 08.11.2004 FORMAT UNCERTAIN #> 9 person G 6/10/02 FORMAT UNCERTAIN # If preferred, do it without groups and return a vector date_format_guess(data = my_df, date_col = \"bad_dates\", groups = FALSE, return = \"vector\") #> Defining 'groups' is strongly recommended! If none exist, consider adding a single artificial group shared by all rows then re-run this function #> Returning vector of data format guesses #> [1] \"year/day/month\" \"FORMAT UNCERTAIN\" \"FORMAT UNCERTAIN\" \"FORMAT UNCERTAIN\" #> [5] \"year/month/day\" \"month/day/year\" \"day/month/year\" \"FORMAT UNCERTAIN\" #> [9] \"FORMAT UNCERTAIN\""},{"path":"https://njlyon0.github.io/supportR/reference/diff_check.html","id":null,"dir":"Reference","previous_headings":"","what":"Compare Difference Between Two Vectors — diff_check","title":"Compare Difference Between Two Vectors — diff_check","text":"Reflexively compares two vectors identifies (1) elements found first second (.e., \"lost\" components) (2) elements found second first (.e., \"gained\" components). particularly helpful manipulating dataframe comparing columns lost gained wrangling steps. Alternately can compare contents two columns see two dataframes differ.","code":""},{"path":"https://njlyon0.github.io/supportR/reference/diff_check.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compare Difference Between Two Vectors — diff_check","text":"","code":"diff_check(old = NULL, new = NULL, sort = TRUE, return = FALSE)"},{"path":"https://njlyon0.github.io/supportR/reference/diff_check.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compare Difference Between Two Vectors — diff_check","text":"old (vector) starting / original object new (vector) ending / modified object sort (logical) whether sort difference two vectors return (logical) whether return two vectors 2-element list","code":""},{"path":"https://njlyon0.github.io/supportR/reference/diff_check.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compare Difference Between Two Vectors — diff_check","text":"return value (unless return = TRUE), called side effects. return = TRUE, returns two-element list","code":""},{"path":"https://njlyon0.github.io/supportR/reference/diff_check.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Compare Difference Between Two Vectors — diff_check","text":"","code":"# Make two vectors vec1 <- c(\"x\", \"a\", \"b\") vec2 <- c(\"y\", \"z\", \"a\") # Compare them! diff_check(old = vec1, new = vec2, return = FALSE) #> Following element(s) found in old object but not new: #> [1] \"b\" \"x\" #> Following element(s) found in new object but not old: #> [1] \"y\" \"z\" # Return the difference for later use diff_out <- diff_check(old = vec1, new = vec2, return = TRUE) #> Following element(s) found in old object but not new: #> [1] \"b\" \"x\" #> Following element(s) found in new object but not old: #> [1] \"y\" \"z\" diff_out #> $lost #> [1] \"b\" \"x\" #> #> $gained #> [1] \"y\" \"z\" #>"},{"path":"https://njlyon0.github.io/supportR/reference/force_num.html","id":null,"dir":"Reference","previous_headings":"","what":"Force Coerce to Numeric — force_num","title":"Force Coerce to Numeric — force_num","text":"Coerces vector numeric vector automatically silences NAs introduced coercion warning. Useful cases non-numbers known exist vector coercion NA expected / unremarkable. Essentially just way forcing coercion succinctly wrapping .numeric suppressWarnings.","code":""},{"path":"https://njlyon0.github.io/supportR/reference/force_num.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Force Coerce to Numeric — force_num","text":"","code":"force_num(x = NULL)"},{"path":"https://njlyon0.github.io/supportR/reference/force_num.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Force Coerce to Numeric — force_num","text":"x (non-numeric) vector containing elements coerced class numeric","code":""},{"path":"https://njlyon0.github.io/supportR/reference/force_num.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Force Coerce to Numeric — force_num","text":"(numeric) vector numeric values","code":""},{"path":"https://njlyon0.github.io/supportR/reference/force_num.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Force Coerce to Numeric — force_num","text":"","code":"# Coerce a character vector to numeric without throwing a warning force_num(x = c(2, \"A\", 4)) #> [1] 2 NA 4"},{"path":"https://njlyon0.github.io/supportR/reference/github_ls.html","id":null,"dir":"Reference","previous_headings":"","what":"List Objects in a GitHub Repository — github_ls","title":"List Objects in a GitHub Repository — github_ls","text":"Accepts GitHub repository URL identifies files specified folder. folder specified, lists top-level repository contents. Recursive listing sub-folders supported additional argument. function works repositories (public private) access.","code":""},{"path":"https://njlyon0.github.io/supportR/reference/github_ls.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"List Objects in a GitHub Repository — github_ls","text":"","code":"github_ls(repo = NULL, folder = NULL, recursive = TRUE, quiet = FALSE)"},{"path":"https://njlyon0.github.io/supportR/reference/github_ls.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"List Objects in a GitHub Repository — github_ls","text":"repo (character) full URL GitHub repository (including \"github.com\") folder (NULL/character) either NULL name folder list. NULL, top-level contents repository listed recursive (logical) whether recursively list contents (.e., list contents sub-folders identified within previously identified sub-folders) quiet (logical) whether print informative message contents folder listed","code":""},{"path":"https://njlyon0.github.io/supportR/reference/github_ls.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"List Objects in a GitHub Repository — github_ls","text":"(dataframe) three-column dataframe including (1) names contents, (2) type content item (e.g., file/directory/etc.), (3) full path starting folder item","code":""},{"path":"https://njlyon0.github.io/supportR/reference/github_ls.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"List Objects in a GitHub Repository — github_ls","text":"","code":"if (FALSE) { # \\dontrun{ # List complete contents of the `supportR` package repository github_ls(repo = \"https://github.com/njlyon0/supportR\", recursive = TRUE, quiet = FALSE) } # }"},{"path":"https://njlyon0.github.io/supportR/reference/github_ls_single.html","id":null,"dir":"Reference","previous_headings":"","what":"List Objects in a Single Folder of a GitHub Repository — github_ls_single","title":"List Objects in a Single Folder of a GitHub Repository — github_ls_single","text":"Accepts GitHub repository URL identifies files specified folder. folder specified, lists top-level repository contents. function works repositories (public private) access.","code":""},{"path":"https://njlyon0.github.io/supportR/reference/github_ls_single.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"List Objects in a Single Folder of a GitHub Repository — github_ls_single","text":"","code":"github_ls_single(repo = NULL, folder = NULL)"},{"path":"https://njlyon0.github.io/supportR/reference/github_ls_single.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"List Objects in a Single Folder of a GitHub Repository — github_ls_single","text":"repo (character) full URL GitHub repository (including \"github.com\") folder (NULL/character) either NULL name folder list. NULL, top-level contents repository listed","code":""},{"path":"https://njlyon0.github.io/supportR/reference/github_ls_single.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"List Objects in a Single Folder of a GitHub Repository — github_ls_single","text":"(dataframe) two-column dataframe including (1) names contents (2) type content item (e.g., file/directory/etc.)","code":""},{"path":"https://njlyon0.github.io/supportR/reference/github_ls_single.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"List Objects in a Single Folder of a GitHub Repository — github_ls_single","text":"","code":"if (FALSE) { # \\dontrun{ # List contents of the top-level of the `supportR` package repository github_ls_single(repo = \"https://github.com/njlyon0/supportR\") } # }"},{"path":"https://njlyon0.github.io/supportR/reference/github_tree.html","id":null,"dir":"Reference","previous_headings":"","what":"Create File Tree of a GitHub Repository — github_tree","title":"Create File Tree of a GitHub Repository — github_tree","text":"Recursively identifies files GitHub repository creates file tree using data.tree package create simple, human-readable visualization folder hierarchy. Folders can specified exclusion case number elements within listed names objects. function works repositories (public private) access.","code":""},{"path":"https://njlyon0.github.io/supportR/reference/github_tree.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create File Tree of a GitHub Repository — github_tree","text":"","code":"github_tree(repo = NULL, exclude = NULL, quiet = FALSE)"},{"path":"https://njlyon0.github.io/supportR/reference/github_tree.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create File Tree of a GitHub Repository — github_tree","text":"repo (character) full URL github repository (including \"github.com\") exclude (character) vector folder names exclude file tree. NULL (default) folders excluded quiet (logical) whether print informative message contents folder listed tree prepared information","code":""},{"path":"https://njlyon0.github.io/supportR/reference/github_tree.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create File Tree of a GitHub Repository — github_tree","text":"(node / R6) data.tree package object class","code":""},{"path":"https://njlyon0.github.io/supportR/reference/github_tree.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create File Tree of a GitHub Repository — github_tree","text":"","code":"if (FALSE) { # \\dontrun{ # Create a file tree for the `supportR` package GitHub repository github_tree(repo = \"github.com/njlyon0/supportR\", exclude = c(\"man\", \"docs\", \".github\")) } # }"},{"path":"https://njlyon0.github.io/supportR/reference/multi_date_check.html","id":null,"dir":"Reference","previous_headings":"","what":"Check Multiple Columns for Non-Dates — multi_date_check","title":"Check Multiple Columns for Non-Dates — multi_date_check","text":"function deprecated realized just special case date_check() function.","code":""},{"path":"https://njlyon0.github.io/supportR/reference/multi_date_check.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check Multiple Columns for Non-Dates — multi_date_check","text":"","code":"multi_date_check(data = NULL, col_vec = NULL)"},{"path":"https://njlyon0.github.io/supportR/reference/multi_date_check.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Check Multiple Columns for Non-Dates — multi_date_check","text":"data (dataframe) object containing least one column supposed dates col_vec (character numeric) vector names column numbers columns containing putative dates data object","code":""},{"path":"https://njlyon0.github.io/supportR/reference/multi_date_check.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check Multiple Columns for Non-Dates — multi_date_check","text":"list length col_vec malformed dates column respective element","code":""},{"path":"https://njlyon0.github.io/supportR/reference/multi_date_check.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Check Multiple Columns for Non-Dates — multi_date_check","text":"","code":"# Make a dataframe to test the function loc <- c(\"LTR\", \"GIL\", \"PYN\", \"RIN\") time <- c('2021-01-01', '2021-01-0w', '1990', '2020-10-xx') time2 <- c('1880-08-08', '2021-01-02', '1992', '2049-11-01') time3 <- c('2022-10-31', 'tomorrow', '1993', NA) # Assemble our vectors into a dataframe sites <- data.frame('site' = loc, 'first_visit' = time, \"second\" = time2, \"third\" = time3) # Use `multi_date_check()` to return only the entries that would be lost multi_date_check(data = sites, col_vec = c(\"first_visit\", \"second\", \"third\")) #> Warning: `multi_date_check()` was deprecated in supportR 1.2.0. #> ℹ Please use `date_check()` instead. #> For 'first_visit', 3 non-dates identified: '2021-01-0w' | '1990' | '2020-10-xx' #> For 'second', 1 non-dates identified: '1992' #> For 'third', 2 non-dates identified: 'tomorrow' | '1993' #> $first_visit #> [1] \"2021-01-0w\" \"1990\" \"2020-10-xx\" #> #> $second #> [1] \"1992\" #> #> $third #> [1] \"tomorrow\" \"1993\" #>"},{"path":"https://njlyon0.github.io/supportR/reference/multi_num_check.html","id":null,"dir":"Reference","previous_headings":"","what":"Check Multiple Columns for Non-Numbers — multi_num_check","title":"Check Multiple Columns for Non-Numbers — multi_num_check","text":"function deprecated realized just special case num_check() function.","code":""},{"path":"https://njlyon0.github.io/supportR/reference/multi_num_check.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check Multiple Columns for Non-Numbers — multi_num_check","text":"","code":"multi_num_check(data = NULL, col_vec = NULL)"},{"path":"https://njlyon0.github.io/supportR/reference/multi_num_check.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Check Multiple Columns for Non-Numbers — multi_num_check","text":"data (dataframe) object containing least one column supposed numbers col_vec (character numeric) vector names column numbers columns containing putative numbers data object","code":""},{"path":"https://njlyon0.github.io/supportR/reference/multi_num_check.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check Multiple Columns for Non-Numbers — multi_num_check","text":"list length col_vec malformed numbers column respective element","code":""},{"path":"https://njlyon0.github.io/supportR/reference/multi_num_check.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Check Multiple Columns for Non-Numbers — multi_num_check","text":"","code":"# Create dataframe with a numeric column where some entries would be coerced into NA spp <- c('salmon', 'bass', 'halibut', 'eel') ct <- c(1, '14x', '_23', 12) ct2 <- c('a', '2', '4', '0') ct3 <- c(NA, 'Y', 'typo', '2') fish <- data.frame('species' = spp, 'count' = ct, 'num_col2' = ct2, 'third_count' = ct3) # Use `multi_num_check()` to return only the entries that would be lost multi_num_check(data = fish, col_vec = c(\"count\", \"num_col2\", \"third_count\")) #> Warning: `multi_num_check()` was deprecated in supportR 1.2.0. #> ℹ Please use `num_check()` instead. #> For 'count', 2 non-numbers identified: '14x' | '_23' #> For 'num_col2', 1 non-numbers identified: 'a' #> For 'third_count', 2 non-numbers identified: 'Y' | 'typo' #> $count #> [1] \"14x\" \"_23\" #> #> $num_col2 #> [1] \"a\" #> #> $third_count #> [1] \"Y\" \"typo\" #>"},{"path":"https://njlyon0.github.io/supportR/reference/name_vec.html","id":null,"dir":"Reference","previous_headings":"","what":"Create Named Vector — name_vec","title":"Create Named Vector — name_vec","text":"Create named vector single line without either manually defining names outset (e.g., c(\"name_1\" = 1, \"name_2\" = 2, ...) spending second line assign names existing vector (e.g., names(vec) <- c(\"name_1\", \"name_2\", ...)). Useful cases need named vector within pipe want break two pipes just define named vector (see tidyr::separate_wider_position)","code":""},{"path":"https://njlyon0.github.io/supportR/reference/name_vec.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create Named Vector — name_vec","text":"","code":"name_vec(content = NULL, name = NULL)"},{"path":"https://njlyon0.github.io/supportR/reference/name_vec.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create Named Vector — name_vec","text":"content (vector) content vector name (vector) names assign vector (must order)","code":""},{"path":"https://njlyon0.github.io/supportR/reference/name_vec.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create Named Vector — name_vec","text":"(named vector) vector contents content argument names name argument","code":""},{"path":"https://njlyon0.github.io/supportR/reference/name_vec.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create Named Vector — name_vec","text":"","code":"# Create a named vector name_vec(content = 1:10, name = paste0(\"text_\", 1:10)) #> text_1 text_2 text_3 text_4 text_5 text_6 text_7 text_8 text_9 text_10 #> 1 2 3 4 5 6 7 8 9 10"},{"path":"https://njlyon0.github.io/supportR/reference/nms_ord.html","id":null,"dir":"Reference","previous_headings":"","what":"Publication-Quality Non-metric Multi-dimensional Scaling (NMS) Ordinations — nms_ord","title":"Publication-Quality Non-metric Multi-dimensional Scaling (NMS) Ordinations — nms_ord","text":"function superseded ordination just special case function. Additionally, ordination provides users much control internal graphics functions used create fundamental elements graph Produces Non-Metric Multi-dimensional Scaling (NMS) ordinations 10 groups. Assigns unique color group draws ellipse around standard deviation points. Automatically adds stress (see vegan::metaMDS explanation \"stress\") legend title. five hollow shapes (see ?graphics::pch()) shapes re-used maximum 2 times 5 groups supplied.","code":""},{"path":"https://njlyon0.github.io/supportR/reference/nms_ord.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Publication-Quality Non-metric Multi-dimensional Scaling (NMS) Ordinations — nms_ord","text":"","code":"nms_ord( mod = NULL, groupcol = NULL, title = NA, colors = c(\"#41b6c4\", \"#c51b7d\", \"#7fbc41\", \"#d73027\", \"#4575b4\", \"#e08214\", \"#8073ac\", \"#f1b6da\", \"#b8e186\", \"#8c96c6\"), shapes = rep(x = 21:25, times = 2), lines = rep(x = 1, times = 10), pt_size = 1.5, pt_alpha = 1, lab_text_size = 1.25, axis_text_size = 1, leg_pos = \"bottomleft\", leg_cont = unique(groupcol) )"},{"path":"https://njlyon0.github.io/supportR/reference/nms_ord.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Publication-Quality Non-metric Multi-dimensional Scaling (NMS) Ordinations — nms_ord","text":"mod (metaMDS/monoMDS) object returned vegan::metaMDS groupcol (dataframe) column specification data includes groups (accepts either bracket $ notation) title (character) string use title plot colors (character) vector colors (hexadecimal codes) length >= group levels (default colorblind safe need 10 built-unique colors) shapes (numeric) vector shapes (values accepted pch) length >= group levels lines (numeric) vector line types (integers) length >= group levels pt_size (numeric) value point size (controlled character expansion .e., cex) pt_alpha (numeric) value transparency points (ranges 0 1) lab_text_size (numeric) value axis label text size axis_text_size (numeric) value axis tick text size leg_pos (character numeric) legend position, either numeric vector x/y coordinates shorthand accepted graphics::legend leg_cont (character) vector desired legend entries. Defaults unique entries groupcol argument (argument provided case syntax legend contents differ data contents)","code":""},{"path":"https://njlyon0.github.io/supportR/reference/nms_ord.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Publication-Quality Non-metric Multi-dimensional Scaling (NMS) Ordinations — nms_ord","text":"(plot) base R ordination ellipse group","code":""},{"path":"https://njlyon0.github.io/supportR/reference/nms_ord.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Publication-Quality Non-metric Multi-dimensional Scaling (NMS) Ordinations — nms_ord","text":"","code":"# \\donttest{ # Use data from the vegan package utils::data(\"varespec\", package = 'vegan') resp <- varespec # Make some columns of known number of groups factor_4lvl <- c(rep.int(\"Trt1\", (nrow(resp)/4)), rep.int(\"Trt2\", (nrow(resp)/4)), rep.int(\"Trt3\", (nrow(resp)/4)), rep.int(\"Trt4\", (nrow(resp)/4))) # And combine them into a single data object data <- cbind(factor_4lvl, resp) # Actually perform multidimensional scaling mds <- vegan::metaMDS(data[-1], autotransform = FALSE, expand = FALSE, k = 2, try = 50) #> Run 0 stress 0.1000211 #> Run 1 stress 0.1715395 #> Run 2 stress 0.1000211 #> ... Procrustes: rmse 1.068764e-05 max resid 4.170213e-05 #> ... Similar to previous best #> Run 3 stress 0.1605747 #> Run 4 stress 0.1613668 #> Run 5 stress 0.1000211 #> ... New best solution #> ... Procrustes: rmse 3.277054e-06 max resid 1.416261e-05 #> ... Similar to previous best #> Run 6 stress 0.1607499 #> Run 7 stress 0.1000211 #> ... New best solution #> ... Procrustes: rmse 3.547968e-07 max resid 1.025797e-06 #> ... Similar to previous best #> Run 8 stress 0.1000211 #> ... Procrustes: rmse 6.553308e-06 max resid 2.717474e-05 #> ... Similar to previous best #> Run 9 stress 0.1000211 #> ... Procrustes: rmse 1.847283e-05 max resid 5.887532e-05 #> ... Similar to previous best #> Run 10 stress 0.1000211 #> ... Procrustes: rmse 1.638284e-06 max resid 6.797019e-06 #> ... Similar to previous best #> Run 11 stress 0.1607505 #> Run 12 stress 0.2186732 #> Run 13 stress 0.1000211 #> ... Procrustes: rmse 9.336186e-06 max resid 4.046768e-05 #> ... Similar to previous best #> Run 14 stress 0.1000211 #> ... Procrustes: rmse 1.860223e-05 max resid 7.962999e-05 #> ... Similar to previous best #> Run 15 stress 0.1000211 #> ... New best solution #> ... Procrustes: rmse 3.514954e-06 max resid 1.498052e-05 #> ... Similar to previous best #> Run 16 stress 0.1000211 #> ... Procrustes: rmse 1.420825e-05 max resid 6.162886e-05 #> ... Similar to previous best #> Run 17 stress 0.160494 #> Run 18 stress 0.1000211 #> ... Procrustes: rmse 6.506975e-06 max resid 2.816072e-05 #> ... Similar to previous best #> Run 19 stress 0.1733341 #> Run 20 stress 0.1000211 #> ... Procrustes: rmse 1.532844e-05 max resid 6.633466e-05 #> ... Similar to previous best #> *** Best solution repeated 4 times # With the scaled object and original dataframe we can use this function nms_ord(mod = mds, groupcol = data$factor_4lvl, title = '4-Level NMS', leg_pos = 'topright', leg_cont = as.character(1:4)) # }"},{"path":"https://njlyon0.github.io/supportR/reference/num_check.html","id":null,"dir":"Reference","previous_headings":"","what":"Check Columns for Non-Numbers — num_check","title":"Check Columns for Non-Numbers — num_check","text":"Identifies elements column(s) changed NA .numeric used column(s). useful quickly identifying \"problem\" entries ostensibly numeric column(s) /read character.","code":""},{"path":"https://njlyon0.github.io/supportR/reference/num_check.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check Columns for Non-Numbers — num_check","text":"","code":"num_check(data = NULL, col = NULL)"},{"path":"https://njlyon0.github.io/supportR/reference/num_check.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Check Columns for Non-Numbers — num_check","text":"data (dataframe) object containing least one column supposed numbers col (character numeric) name(s) column number(s) column(s) containing putative numbers data object","code":""},{"path":"https://njlyon0.github.io/supportR/reference/num_check.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check Columns for Non-Numbers — num_check","text":"(list) malformed numbers supplied column separate list elements","code":""},{"path":"https://njlyon0.github.io/supportR/reference/num_check.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Check Columns for Non-Numbers — num_check","text":"","code":"# Create dataframe with a numeric column where some entries would be coerced into NA spp <- c(\"salmon\", \"bass\", \"halibut\", \"eel\") ct <- c(1, \"14x\", \"_23\", 12) ct2 <- c(\"a\", \"2\", \"4\", \"0\") ct3 <- c(NA, \"Y\", \"typo\", \"2\") fish <- data.frame(\"species\" = spp, \"count\" = ct, \"num_col2\" = ct2, \"third_count\" = ct3) # Use `num_check()` to return only the entries that would be lost num_check(data = fish, col = c(\"count\", \"num_col2\", \"third_count\")) #> For 'count', 2 non-numbers identified: '14x' | '_23' #> For 'num_col2', 1 non-numbers identified: 'a' #> For 'third_count', 2 non-numbers identified: 'Y' | 'typo' #> $count #> [1] \"14x\" \"_23\" #> #> $num_col2 #> [1] \"a\" #> #> $third_count #> [1] \"Y\" \"typo\" #>"},{"path":"https://njlyon0.github.io/supportR/reference/ordination.html","id":null,"dir":"Reference","previous_headings":"","what":"Create an Ordination with Ellipses for Groups — ordination","title":"Create an Ordination with Ellipses for Groups — ordination","text":"Produces Nonmetric Multidimensional Scaling (NMS) Principal Coordinate Analysis (PCoA) 10 groups. Draws ellipse around standard deviation points group. default, assigns unique color (colorblind-safe) point shape group. user supplies colors/shapes function can support 10 groups. NMS ordinations, includes stress legend title (see ?vegan::metaMDS explanation \"stress\"). PCoA ordinations includes percent variation explained parenthetically axis labels.","code":""},{"path":"https://njlyon0.github.io/supportR/reference/ordination.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create an Ordination with Ellipses for Groups — ordination","text":"","code":"ordination(mod = NULL, grps = NULL, ...)"},{"path":"https://njlyon0.github.io/supportR/reference/ordination.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create an Ordination with Ellipses for Groups — ordination","text":"mod (pcoa | monoMDS/metaMDS) object returned ape::pcoa vegan::metaMDS grps (vector) vector categorical groups data. Must length number rows original data object ... additional arguments passed graphics::plot, graphics::points, scales::alpha, vegan::ordiellipse, graphics::legend. Open GitHub Issue function must support additional arguments","code":""},{"path":"https://njlyon0.github.io/supportR/reference/ordination.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create an Ordination with Ellipses for Groups — ordination","text":"(plot) base R ordination ellipse group","code":""},{"path":"https://njlyon0.github.io/supportR/reference/ordination.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create an Ordination with Ellipses for Groups — ordination","text":"","code":"# \\donttest{ # Use data from the vegan package utils::data(\"varespec\", package = 'vegan') # Make some columns of known number of groups treatment <- c(rep.int(\"Trt1\", (nrow(varespec)/4)), rep.int(\"Trt2\", (nrow(varespec)/4)), rep.int(\"Trt3\", (nrow(varespec)/4)), rep.int(\"Trt4\", (nrow(varespec)/4))) # And combine them into a single data object data <- cbind(treatment, varespec) # Get a distance matrix from the data dist <- vegan::vegdist(varespec, method = 'kulczynski') # Perform PCoA / NMS pcoa_mod <- ape::pcoa(dist) nms_mod <- vegan::metaMDS(data[-1], autotransform = FALSE, expand = FALSE, k = 2, try = 50) #> Run 0 stress 0.1000211 #> Run 1 stress 0.160494 #> Run 2 stress 0.1000211 #> ... Procrustes: rmse 2.418569e-05 max resid 0.0001051768 #> ... Similar to previous best #> Run 3 stress 0.173334 #> Run 4 stress 0.1000211 #> ... New best solution #> ... Procrustes: rmse 4.052296e-06 max resid 1.763271e-05 #> ... Similar to previous best #> Run 5 stress 0.1000211 #> ... Procrustes: rmse 5.817102e-07 max resid 2.50098e-06 #> ... Similar to previous best #> Run 6 stress 0.1616352 #> Run 7 stress 0.1000211 #> ... Procrustes: rmse 3.830352e-07 max resid 1.366122e-06 #> ... Similar to previous best #> Run 8 stress 0.1000211 #> ... Procrustes: rmse 8.692326e-06 max resid 3.779172e-05 #> ... Similar to previous best #> Run 9 stress 0.1000211 #> ... Procrustes: rmse 1.426434e-06 max resid 6.135848e-06 #> ... Similar to previous best #> Run 10 stress 0.1000211 #> ... Procrustes: rmse 2.061586e-06 max resid 8.946507e-06 #> ... Similar to previous best #> Run 11 stress 0.1000211 #> ... Procrustes: rmse 9.422265e-06 max resid 4.095289e-05 #> ... Similar to previous best #> Run 12 stress 0.1000211 #> ... Procrustes: rmse 2.74398e-05 max resid 0.0001180424 #> ... Similar to previous best #> Run 13 stress 0.1613105 #> Run 14 stress 0.1616352 #> Run 15 stress 0.1532704 #> Run 16 stress 0.1000211 #> ... New best solution #> ... Procrustes: rmse 5.073255e-06 max resid 2.188445e-05 #> ... Similar to previous best #> Run 17 stress 0.1000211 #> ... Procrustes: rmse 4.585748e-06 max resid 1.96768e-05 #> ... Similar to previous best #> Run 18 stress 0.1000211 #> ... Procrustes: rmse 5.191166e-06 max resid 2.179527e-05 #> ... Similar to previous best #> Run 19 stress 0.1000211 #> ... New best solution #> ... Procrustes: rmse 1.657658e-06 max resid 5.468007e-06 #> ... Similar to previous best #> Run 20 stress 0.1000211 #> ... Procrustes: rmse 1.148052e-05 max resid 4.585103e-05 #> ... Similar to previous best #> *** Best solution repeated 2 times # Create PCoA ordination (with optional agruments) ordination(mod = pcoa_mod, grps = data$treatment, bg = c(\"red\", \"blue\", \"purple\", \"orange\"), lty = 2, col = \"black\") # Create NMS ordination ordination(mod = nms_mod, grps = data$treatment, alpha = 0.3, x = \"topright\", legend = LETTERS[1:4]) # }"},{"path":"https://njlyon0.github.io/supportR/reference/pcoa_ord.html","id":null,"dir":"Reference","previous_headings":"","what":"Publication-Quality Principal Coordinates Analysis (PCoA) Ordinations — pcoa_ord","title":"Publication-Quality Principal Coordinates Analysis (PCoA) Ordinations — pcoa_ord","text":"function superseded ordination just special case function. Additionally, ordination provides users much control internal graphics functions used create fundamental elements graph Produces Principal Coordinates Analysis (PCoA) ordinations 10 groups. Assigns unique color group draws ellipse around standard deviation points. Automatically adds percent variation explained first two principal component axes parenthetically axis labels. five hollow shapes (see ?graphics::pch) shapes re-used maximum 2 times 5 groups supplied.","code":""},{"path":"https://njlyon0.github.io/supportR/reference/pcoa_ord.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Publication-Quality Principal Coordinates Analysis (PCoA) Ordinations — pcoa_ord","text":"","code":"pcoa_ord( mod = NULL, groupcol = NULL, title = NA, colors = c(\"#41b6c4\", \"#c51b7d\", \"#7fbc41\", \"#d73027\", \"#4575b4\", \"#e08214\", \"#8073ac\", \"#f1b6da\", \"#b8e186\", \"#8c96c6\"), shapes = rep(x = 21:25, times = 2), lines = rep(x = 1, times = 10), pt_size = 1.5, pt_alpha = 1, lab_text_size = 1.25, axis_text_size = 1, leg_pos = \"bottomleft\", leg_cont = unique(groupcol) )"},{"path":"https://njlyon0.github.io/supportR/reference/pcoa_ord.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Publication-Quality Principal Coordinates Analysis (PCoA) Ordinations — pcoa_ord","text":"mod (pcoa) object returned ape::pcoa groupcol (dataframe) column specification data includes groups (accepts either bracket $ notation) title (character) string use title plot colors (character) vector colors (hexadecimal codes) length >= group levels (default colorblind safe need 10 built-unique colors) shapes (numeric) vector shapes (values accepted pch) length >= group levels lines (numeric) vector line types (integers) length >= group levels pt_size (numeric) value point size (controlled character expansion .e., cex) pt_alpha (numeric) value transparency points (ranges 0 1) lab_text_size (numeric) value axis label text size axis_text_size (numeric) value axis tick text size leg_pos (character numeric) legend position, either numeric vector x/y coordinates shorthand accepted graphics::legend leg_cont (character) vector desired legend entries. Defaults unique entries groupcol argument (argument provided case syntax legend contents differ data contents)","code":""},{"path":"https://njlyon0.github.io/supportR/reference/pcoa_ord.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Publication-Quality Principal Coordinates Analysis (PCoA) Ordinations — pcoa_ord","text":"(plot) base R ordination ellipse group","code":""},{"path":"https://njlyon0.github.io/supportR/reference/pcoa_ord.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Publication-Quality Principal Coordinates Analysis (PCoA) Ordinations — pcoa_ord","text":"","code":"# \\donttest{ # Use data from the vegan package data(\"varespec\", package = 'vegan') resp <- varespec # Make some columns of known number of groups factor_4lvl <- c(rep.int(\"Trt1\", (nrow(resp)/4)), rep.int(\"Trt2\", (nrow(resp)/4)), rep.int(\"Trt3\", (nrow(resp)/4)), rep.int(\"Trt4\", (nrow(resp)/4))) # And combine them into a single data object data <- cbind(factor_4lvl, resp) # Get a distance matrix from the data dist <- vegan::vegdist(resp, method = 'kulczynski') # Perform a PCoA on the distance matrix to get points for an ordination pnts <- ape::pcoa(dist) # Test the function for 4 groups pcoa_ord(mod = pnts, groupcol = data$factor_4lvl) # }"},{"path":"https://njlyon0.github.io/supportR/reference/replace_non_ascii.html","id":null,"dir":"Reference","previous_headings":"","what":"Replace Non-ASCII Characters with Comparable ASCII Characters — replace_non_ascii","title":"Replace Non-ASCII Characters with Comparable ASCII Characters — replace_non_ascii","text":"Finds non-ASCII (American Standard Code Information Interchange) characters character vector replaces ASCII characters visually similar possible. example, various special dash types (e.g., em dash, en dash, etc.) replaced hyphen. function return warning finds non-ASCII characters hard-coded replacement. Please open GitHub Issue encounter warning suggestion replacement character particular character.","code":""},{"path":"https://njlyon0.github.io/supportR/reference/replace_non_ascii.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Replace Non-ASCII Characters with Comparable ASCII Characters — replace_non_ascii","text":"","code":"replace_non_ascii(x = NULL, include_letters = FALSE)"},{"path":"https://njlyon0.github.io/supportR/reference/replace_non_ascii.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Replace Non-ASCII Characters with Comparable ASCII Characters — replace_non_ascii","text":"x (character) vector replace non-ASCII characters include_letters (logical) whether include letters accents (e.g., u umlaut, etc.). Defaults FALSE","code":""},{"path":"https://njlyon0.github.io/supportR/reference/replace_non_ascii.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Replace Non-ASCII Characters with Comparable ASCII Characters — replace_non_ascii","text":"(character) vector non-ASCII characters replaced ASCII equivalents","code":""},{"path":"https://njlyon0.github.io/supportR/reference/replace_non_ascii.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Replace Non-ASCII Characters with Comparable ASCII Characters — replace_non_ascii","text":"","code":"# Make a vector of the hexadecimal codes for several non-ASCII characters ## This function accepts the characters themselves but CRAN checks do not non_ascii <- c(\"\\u201C\", \"\\u00AC\", \"\\u00D7\") # Invoke function (ascii <- replace_non_ascii(x = non_ascii)) #> [1] \"\\\"\" \"-\" \"x\""},{"path":"https://njlyon0.github.io/supportR/reference/rmd_export.html","id":null,"dir":"Reference","previous_headings":"","what":"Knit an R Markdown File and Export to Google Drive — rmd_export","title":"Knit an R Markdown File and Export to Google Drive — rmd_export","text":"function allows knit specified R Markdown file locally export Google Drive folder provided link. NOTE used googledrive::drive_auth prompt authorize Google account new browser tab. check box screen continuing able use function clear browser cache re-authenticate. recommend invoking drive_auth beforehand reduce chances error","code":""},{"path":"https://njlyon0.github.io/supportR/reference/rmd_export.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Knit an R Markdown File and Export to Google Drive — rmd_export","text":"","code":"rmd_export( rmd = NULL, out_path = getwd(), out_name = NULL, out_type = \"html\", drive_link )"},{"path":"https://njlyon0.github.io/supportR/reference/rmd_export.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Knit an R Markdown File and Export to Google Drive — rmd_export","text":"rmd (character) name path R markdown file knit out_path (character) path knit file's destination (defaults path returned getwd()) out_name (character) desired name knit file (without file suffix) out_type (character) either \"html\" \"pdf\" depending YAML entry output: field R Markdown file drive_link (character) full URL drive folder upload knit document","code":""},{"path":"https://njlyon0.github.io/supportR/reference/rmd_export.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Knit an R Markdown File and Export to Google Drive — rmd_export","text":"return value, called knit R Markdown file","code":""},{"path":"https://njlyon0.github.io/supportR/reference/rmd_export.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Knit an R Markdown File and Export to Google Drive — rmd_export","text":"","code":"if (FALSE) { # \\dontrun{ # Authorize R to interact with GoogleDrive googledrive::drive_auth() ## NOTE: See warning about possible misstep at this stage # Use `rmd_export()` to knit and export an .Rmd file rmd_export(rmd = \"my_markdown.Rmd\", in_path = getwd(), out_path = getwd(), out_name = \"my_markdown\", out_type = \"html\", drive_link = \"\") } # }"},{"path":"https://njlyon0.github.io/supportR/reference/safe_rename.html","id":null,"dir":"Reference","previous_headings":"","what":"Safely Rename Columns in a Dataframe — safe_rename","title":"Safely Rename Columns in a Dataframe — safe_rename","text":"Replaces specified column names user-defined vector new column name(s). operation done \"safely\" specifically matches 'bad' name corresponding 'good' name thus minimizes risk accidentally replacing wrong column name.","code":""},{"path":"https://njlyon0.github.io/supportR/reference/safe_rename.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Safely Rename Columns in a Dataframe — safe_rename","text":"","code":"safe_rename(data = NULL, bad_names = NULL, good_names = NULL)"},{"path":"https://njlyon0.github.io/supportR/reference/safe_rename.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Safely Rename Columns in a Dataframe — safe_rename","text":"data (dataframe dataframe-like) object column names match values passed bad_names argument bad_names (character) vector column names replace original data object. Order need match data column order must match good_names vector order good_names (character) vector column names use replacements data object. Order need match data column order must match good_names vector order","code":""},{"path":"https://njlyon0.github.io/supportR/reference/safe_rename.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Safely Rename Columns in a Dataframe — safe_rename","text":"(dataframe dataframe-like) renamed columns","code":""},{"path":"https://njlyon0.github.io/supportR/reference/safe_rename.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Safely Rename Columns in a Dataframe — safe_rename","text":"","code":"# Make a dataframe to demonstrate df <- data.frame(\"first\" = 1:3, \"middle\" = 4:6, \"second\" = 7:9) # Invoke the function safe_rename(data = df, bad_names = c(\"second\", \"middle\"), good_names = c(\"third\", \"second\")) #> first second third #> 1 1 4 7 #> 2 2 5 8 #> 3 3 6 9"},{"path":"https://njlyon0.github.io/supportR/reference/summary_table.html","id":null,"dir":"Reference","previous_headings":"","what":"Generate Summary Table for Supplied Response and Grouping Variables — summary_table","title":"Generate Summary Table for Supplied Response and Grouping Variables — summary_table","text":"Calculates mean, standard deviation, sample size, standard error given response variable within user-defined grouping variables. meant convenience instead dplyr::group_by followed dplyr::summarize iteratively .","code":""},{"path":"https://njlyon0.github.io/supportR/reference/summary_table.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Generate Summary Table for Supplied Response and Grouping Variables — summary_table","text":"","code":"summary_table( data = NULL, groups = NULL, response = NULL, drop_na = FALSE, round_digits = 2 )"},{"path":"https://njlyon0.github.io/supportR/reference/summary_table.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Generate Summary Table for Supplied Response and Grouping Variables — summary_table","text":"data (dataframe dataframe-like) object column names match values passed groups response arguments groups (character) vector column names group response (character) name column name calculate summary statistics (column must numeric) drop_na (logical) whether drop NAs grouping variables. Defaults FALSE round_digits (numeric) number digits mean, standard deviation, standard error rounded","code":""},{"path":"https://njlyon0.github.io/supportR/reference/summary_table.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Generate Summary Table for Supplied Response and Grouping Variables — summary_table","text":"(dataframe) summary table containing mean, standard deviation, sample size, standard error supplied response variable","code":""},{"path":"https://njlyon0.github.io/supportR/reference/supportR-package.html","id":null,"dir":"Reference","previous_headings":"","what":"supportR: Support Functions for Wrangling and Visualization — supportR-package","title":"supportR: Support Functions for Wrangling and Visualization — supportR-package","text":"Suite helper functions data wrangling visualization. theme functions tend towards simple, short, narrowly-scoped. functions built tasks often recur large enough scope warrant ecosystem interdependent functions.","code":""},{"path":[]},{"path":"https://njlyon0.github.io/supportR/reference/supportR-package.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"supportR: Support Functions for Wrangling and Visualization — supportR-package","text":"Maintainer: Nicholas J Lyon njlyon@alumni.iastate.edu (ORCID) [copyright holder]","code":""},{"path":"https://njlyon0.github.io/supportR/reference/tabularize_md.html","id":null,"dir":"Reference","previous_headings":"","what":"Make a Markdown File into a Table — tabularize_md","title":"Make a Markdown File into a Table — tabularize_md","text":"Accepts one markdown file (.e., \"md\" file extension) returns content table. Nested heading structure markdown file–defined hashtags / pounds signs (#)–identified preserved columns resulting tabular format. line non-heading content file preserved right-column one row table.","code":""},{"path":"https://njlyon0.github.io/supportR/reference/tabularize_md.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Make a Markdown File into a Table — tabularize_md","text":"","code":"tabularize_md(file = NULL)"},{"path":"https://njlyon0.github.io/supportR/reference/tabularize_md.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Make a Markdown File into a Table — tabularize_md","text":"file (character/url connection) name file path markdown file transform table connection object URL markdown file (see ?base::url details)","code":""},{"path":"https://njlyon0.github.io/supportR/reference/tabularize_md.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Make a Markdown File into a Table — tabularize_md","text":"(dataframe) table one additional column heading levels document (e.g., first second level headings document, resulting table three columns) one row per line non-heading content markdown file.","code":""},{"path":"https://njlyon0.github.io/supportR/reference/tabularize_md.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Make a Markdown File into a Table — tabularize_md","text":"","code":"if (FALSE) { # \\dontrun{ # Identify URL to the NEWS.md file in `supportR` GitHub repo md_cxn <- url(\"https://raw.githubusercontent.com/njlyon0/supportR/main/NEWS.md\") # Transform it into a table md_df <- tabularize_md(file = md_cxn) # Close connection (just good housekeeping to do so) close(md_cxn) # Check out the table format str(md_df) } # }"},{"path":"https://njlyon0.github.io/supportR/reference/theme_lyon.html","id":null,"dir":"Reference","previous_headings":"","what":"Complete ggplot2 Theme for Non-Data Aesthetics — theme_lyon","title":"Complete ggplot2 Theme for Non-Data Aesthetics — theme_lyon","text":"Custom alternative ggtheme options built ggplot2. Removes gray boxes grid lines plot background. Increases font size tick marks axis labels. Removes gray box legend background legend key. Removes legend title.","code":""},{"path":"https://njlyon0.github.io/supportR/reference/theme_lyon.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Complete ggplot2 Theme for Non-Data Aesthetics — theme_lyon","text":"","code":"theme_lyon(title_size = 16, text_size = 13)"},{"path":"https://njlyon0.github.io/supportR/reference/theme_lyon.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Complete ggplot2 Theme for Non-Data Aesthetics — theme_lyon","text":"title_size (numeric) size font axis titles text_size (numeric) size font tick labels","code":""},{"path":"https://njlyon0.github.io/supportR/reference/theme_lyon.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Complete ggplot2 Theme for Non-Data Aesthetics — theme_lyon","text":"(ggplot theme) list ggplot2 theme elements","code":""},{"path":"https://njlyon0.github.io/supportR/news/index.html","id":"supportr-version-140900","dir":"Changelog","previous_headings":"","what":"supportR Version 1.4.0.900","title":"supportR Version 1.4.0.900","text":"Development version, changes preceding version listed : Function fix: Fixed issue replace_non_ascii include_letters set FALSE warning still generated non-ASCII letters part larger string (e.g., “xyz”, etc.)","code":""},{"path":"https://njlyon0.github.io/supportR/news/index.html","id":"supportr-version-140","dir":"Changelog","previous_headings":"","what":"supportR Version 1.4.0","title":"supportR Version 1.4.0","text":"CRAN release: 2024-06-13 Changes preceding version listed New function: replace_non_ascii. Replaces non-ASCII characters ASCII characters visually similar possible New function: count. Counts occurrences unique element provided vector New function: ordination. Generic function creates either NMS PCoA ordinations. Makes extensive use ... argument greatly increase level control user can expect internal base R graphing functions. Supersedes nms_ord pcoa_ord. Superseded functions: nms_ord pcoa_ord now superseded special cases ordination New function behavior: nms_ord pcoa_ord now support modifying axis label text size axis tickmark text size Began process adding units tests functions package. Users may notice small cases informative errors/warnings returned generally shouldn’t change function behavior appreciable way","code":""},{"path":"https://njlyon0.github.io/supportR/news/index.html","id":"supportr-version-130","dir":"Changelog","previous_headings":"","what":"supportR Version 1.3.0","title":"supportR Version 1.3.0","text":"CRAN release: 2024-04-12 Changes preceding version listed New function: force_num. Coerces vector numeric automatically silences warnings due coercing values NA New function: safe_rename. Renames columns given dataframe matching ‘bad’ names ‘good’ names New function: tabularize_md. Converts markdown file table retains nested structure headings file","code":""},{"path":"https://njlyon0.github.io/supportR/news/index.html","id":"supportr-version-120","dir":"Changelog","previous_headings":"","what":"supportR Version 1.2.0","title":"supportR Version 1.2.0","text":"CRAN release: 2023-08-22 Changes preceding version listed New function: name_vec. Creates named vector specified contents names github_tree now supports excluding directories folder tree (default behavior now) New function behavior: num_check now accepts multiple column names/numbers col argument New function behavior: date_check now accepts multiple column names/numbers col argument Deprecated function: multi_num_check now deprecated (warning) special case num_check Deprecated function: multi_date_check now deprecated (warning) special case date_check","code":""},{"path":"https://njlyon0.github.io/supportR/news/index.html","id":"supportr-version-110","dir":"Changelog","previous_headings":"","what":"supportR Version 1.1.0","title":"supportR Version 1.1.0","text":"CRAN release: 2023-07-08 Changes preceding version listed New function: github_ls. Lists contents specified GitHub repository either recursively top-level/specified folder New function: github_tree. Creates file tree diagram specified GitHub repository Refined clarified package vignette pcoa_ord nms_ord now include arguments changing point size (pt_size) opacity (pt_alpha; .e., transparency). Changes point size reflected legend changes opacity reflected legend points Fixed typo message returned diff_check Added example documentation crop_tri","code":""},{"path":"https://njlyon0.github.io/supportR/news/index.html","id":"supportr-version-100","dir":"Changelog","previous_headings":"","what":"supportR Version 1.0.0","title":"supportR Version 1.0.0","text":"CRAN release: 2023-02-09 first fully-functioning version package. currently ERRORs, WARNINGs, NOTEs devtools::check","code":""}]