diff --git a/articles/ltertools.html b/articles/ltertools.html index a87145c..a947f7e 100644 --- a/articles/ltertools.html +++ b/articles/ltertools.html @@ -121,12 +121,12 @@

Harmonization# Generate two simple tables ## Dataframe 1 df1 <- data.frame("xx" = c(1:3), - "unwanted" = c("not", "needed", "column"), - "yy" = letters[1:3]) + "unwanted" = c("not", "needed", "column"), + "yy" = letters[1:3]) ## Dataframe 2 df2 <- data.frame("LETTERS" = letters[4:7], - "NUMBERS" = c(4:7), - "BONUS" = c("plantae", "animalia", "fungi", "protista")) + "NUMBERS" = c(4:7), + "BONUS" = c("plantae", "animalia", "fungi", "protista")) # Generate a known temporary folder for exporting temp_folder <- tempdir() @@ -134,11 +134,67 @@

Harmonization# Export both files to that folder utils::write.csv(x = df1, file = file.path(temp_folder, "df1.csv"), row.names = FALSE) utils::write.csv(x = df2, file = file.path(temp_folder, "df2.csv"), row.names = FALSE) -

With some example files generated, we can now demonstrate the actual -workflow! The most fundamental of these functions is -harmonize. This function

-

begin_key

-

harmonize

+

While the raw data must be in a folder, the data key is a dataframe +in R to allow more flexibility on the user’s end about file format / +storage (many LTER working groups like generating their key +collaboratively as a Google Sheet). For this example, we can generate a +data key manually here.

+
+# Generate a key that matches the data we created above
+key_obj <- data.frame("source" = c(rep("df1.csv", 3), 
+                                   rep("df2.csv", 3)),
+                      "raw_name" = c("xx", "unwanted", "yy",
+                                     "LETTERS", "NUMBERS", "BONUS"),
+                      "tidy_name" = c("numbers", NA, "letters",
+                                      "letters", "numbers", "kingdom"))
+# Check that out
+key_obj
+#>    source raw_name tidy_name
+#> 1 df1.csv       xx   numbers
+#> 2 df1.csv unwanted      <NA>
+#> 3 df1.csv       yy   letters
+#> 4 df2.csv  LETTERS   letters
+#> 5 df2.csv  NUMBERS   numbers
+#> 6 df2.csv    BONUS   kingdom
+

With some example files and a key object generated, we can now +demonstrate the actual workflow! The most fundamental of these functions +is harmonize. This function requires the “column key” +described above, as well as the folder containing the raw data +files to which the key refers. Raw data format can also be specified to +any of CSV, TXT, XLS, and/or XLSX. There is a quiet +argument that will silence messages about key-to-data mismatches (either +expected-but-missing column names or unexpected columns).

+
+# Use the key to harmonize our example data
+harmony_df <- ltertools::harmonize(key = key_obj, raw_folder = temp_folder, 
+                                   data_format = "csv", quiet = TRUE)
+
+# Check the structure of that
+utils::str(harmony_df)
+

For users that want help generating the column key, we have created +the begin_key function. This function accepts the raw +folder and data format arguments included in harmonize with +an additional (optional) guess_tidy argument. If +TRUE, that argument attempts to “guess” the desired tidy +name for each raw column name; it does this by standardizing casing and +removing special characters. This may be ideal if you anticipate that +many of your raw data files only differ in casing/special characters +rather than being phrased incompatibly. For our example here we’ll allow +the key to “guess”.

+
+# Generate a column key with "guesses" at tidy column names
+test_key <- ltertools::begin_key(raw_folder = temp_folder, data_format = "csv", 
+                                 guess_tidy = TRUE)
+
+# Examine what that generated
+test_key
+#>    source raw_name tidy_name
+#> 1 df1.csv       xx        xx
+#> 2 df1.csv unwanted  unwanted
+#> 3 df1.csv       yy        yy
+#> 4 df2.csv  LETTERS   letters
+#> 5 df2.csv  NUMBERS   numbers
+#> 6 df2.csv    BONUS     bonus

A visual version of this column key approach to harmonization is included for convenience here:

@@ -155,7 +211,7 @@

Wrangling
+
 # Read in all (both) of the CSVs that we created above
 data_list <- ltertools::read(raw_folder = temp_folder, data_format = "csv")
 
@@ -177,7 +233,7 @@ 

Wrangling
+
 # Calculate CV (excluding missing values)
 ltertools::cv(x = c(4, 5, 6, 4, 5, 5), na_rm = TRUE)
 #> [1] 0.1557461
@@ -187,7 +243,7 @@

Wrangling
+
 # Convert some temperatures from F to Kelvin
 convert_temp(value = c(0, 32, 110), from = "Fahrenheit", to = "k")
 #> [1] 255.3722 273.1500 316.4833
@@ -209,13 +265,13 @@

LTER Information

Sites can be specified by their three letter site code or all sites in a particular habitat can be included.

-
+
 

Running the function without specifying site codes or habitat types will result in a timeline of all active LTER sites.

-
+
 # Check the timeline for all LTER sites
 ltertools::site_timeline()

diff --git a/pkgdown.yml b/pkgdown.yml index 6e0bdfc..481e13f 100644 --- a/pkgdown.yml +++ b/pkgdown.yml @@ -3,7 +3,7 @@ pkgdown: 2.0.7 pkgdown_sha: ~ articles: ltertools: ltertools.html -last_built: 2024-02-16T15:31Z +last_built: 2024-02-16T15:36Z urls: reference: https://lter.github.io/ltertools/reference article: https://lter.github.io/ltertools/articles diff --git a/search.json b/search.json index b54d10f..b432c97 100644 --- a/search.json +++ b/search.json @@ -1 +1 @@ -[{"path":"https://lter.github.io/ltertools/CONTRIBUTING.html","id":null,"dir":"","previous_headings":"","what":"Contributing to ltertools","title":"Contributing to ltertools","text":"Please follow contributing instructions relevant subheading consider best contribute ltertools. Thank interest!","code":""},{"path":"https://lter.github.io/ltertools/CONTRIBUTING.html","id":"contributing-a-new-function","dir":"","previous_headings":"","what":"Contributing a New Function","title":"Contributing to ltertools","text":"Adding function ’ve written core ltertools’ reason existing. function ’d like contribute please following: Open GitHub issue paste entirety function issue Please also provide 1-paragraph description function /contexts function invoked description provide sufficient detail R expert can gain fundamental understanding function’s purpose can necessary maintenance integration likely form basis “Description” field function package users can access ?function feel free use existing function’s help file reference (e.g., ?dplyr::filter, etc.) ’ve provided information can work towards standardizing function formatting (casing, syntax, etc.) function can included suite available tools!","code":""},{"path":"https://lter.github.io/ltertools/CONTRIBUTING.html","id":"function-credit","dir":"","previous_headings":"Contributing a New Function","what":"Function Credit","title":"Contributing to ltertools","text":"decide contribute function ltertools offer following benefits: list preferred name DESCRIPTION file author ’d like, can add : email, professional website, link ORCiD also specifically reference description field function(s) contribute taking steps hope ensure intellectual contributions appropriately credited ltertools users can find facets professional work based links R package.","code":""},{"path":"https://lter.github.io/ltertools/CONTRIBUTING.html","id":"minor-edits--suggestions","dir":"","previous_headings":"","what":"Minor Edits / Suggestions","title":"Contributing to ltertools","text":"either (1) calling attention bug/error (2) making small suggestion improvement, suggest open GitHub issue. bugs, please include minimal reproducible example can quickly reproduce resolve bug suggestions, please precise possible know scope changes needed implement idea(s)","code":""},{"path":"https://lter.github.io/ltertools/CONTRIBUTING.html","id":"major-changes","dir":"","previous_headings":"","what":"Major Changes","title":"Contributing to ltertools","text":"major change necessitating systemic/structural changes ltertools recommend following: Fork GitHub repository Add function script (necessary data files) dev folder fork finished edits, submit pull request","code":""},{"path":"https://lter.github.io/ltertools/CONTRIBUTING.html","id":"style-guide","dir":"","previous_headings":"","what":"Style Guide","title":"Contributing to ltertools","text":"happy tweak function/argument names needed maintain concistent “feel” functions ltertools. said, ’d like make changes welcome though aesthetic changes optional. ltertools adhere following stylistic elements: Use “snake case” (.e., lowercase separated underscores) functions arguments (e.g., my_function(argument_1 = ...), etc.) function prints informative messages, include quiet argument accepts logical (.e., TRUE FALSE). quiet = TRUE please suppress messages Include errors / warnings user inputs arguments inappropriate class structure","code":""},{"path":"https://lter.github.io/ltertools/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"BSD 3 Clause License","title":"BSD 3 Clause License","text":"Copyright (c) [], [] Redistribution use source binary forms, without modification, permitted provided following conditions met: SOFTWARE PROVIDED COPYRIGHT HOLDERS CONTRIBUTORS “” EXPRESS IMPLIED WARRANTIES, INCLUDING, LIMITED , IMPLIED WARRANTIES MERCHANTABILITY FITNESS PARTICULAR PURPOSE DISCLAIMED. EVENT SHALL COPYRIGHT HOLDER CONTRIBUTORS LIABLE DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, LIMITED , PROCUREMENT SUBSTITUTE GOODS SERVICES; LOSS USE, DATA, PROFITS; BUSINESS INTERRUPTION) HOWEVER CAUSED THEORY LIABILITY, WHETHER CONTRACT, STRICT LIABILITY, TORT (INCLUDING NEGLIGENCE OTHERWISE) ARISING WAY USE SOFTWARE, EVEN ADVISED POSSIBILITY DAMAGE.","code":"Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of the nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission."},{"path":"https://lter.github.io/ltertools/articles/ltertools.html","id":"overview","dir":"Articles","previous_headings":"","what":"Overview","title":"ltertools Vignette","text":"ltertools package goal ltertools centralize R functions created members Long Term Ecological Research (LTER) community. Many functions likely broad relevance expands beyond context creation package attempt share tools limit amount “re-inventing wheel” silos. conceptual theme functions ltertools necessarily broad given scope community aim serve. said, identity package likely become clear accrue contributed functions. vignette describes main functions ltertools currently exist.","code":"# devtools::install_github(\"lter/ltertools\") library(ltertools)"},{"path":"https://lter.github.io/ltertools/articles/ltertools.html","id":"harmonization","dir":"Articles","previous_headings":"Overview","what":"Harmonization","title":"ltertools Vignette","text":"LTER Network hypothesis-driven focus long term data sites network. results data may reasonably compared –potentially–quite differently formatted based logic investigators responsible dataset. Data harmonization (process resolving formatting inconsistencies facilitate combination/comparison across projects) therefore significant hurdle many projects using LTER data. suggest “column key”-based approach potential greatly simplify harmonization efforts. method requires researchers develop 3-column key contains (1) name raw data file harmonized, (2) name columns files, (3) “tidy name” corresponds raw column name. dataset can read raw names replaced tidy ones specified key. done files specified folder, can combined newly consistent column names. demonstrate workflow, need create example data tables export temporary directory (can read back required harmonization functions). example files generated, can now demonstrate actual workflow! fundamental functions harmonize. function begin_key harmonize visual version column key approach harmonization included convenience :","code":"# Generate two simple tables ## Dataframe 1 df1 <- data.frame(\"xx\" = c(1:3), \"unwanted\" = c(\"not\", \"needed\", \"column\"), \"yy\" = letters[1:3]) ## Dataframe 2 df2 <- data.frame(\"LETTERS\" = letters[4:7], \"NUMBERS\" = c(4:7), \"BONUS\" = c(\"plantae\", \"animalia\", \"fungi\", \"protista\")) # Generate a known temporary folder for exporting temp_folder <- tempdir() # Export both files to that folder utils::write.csv(x = df1, file = file.path(temp_folder, \"df1.csv\"), row.names = FALSE) utils::write.csv(x = df2, file = file.path(temp_folder, \"df2.csv\"), row.names = FALSE)"},{"path":"https://lter.github.io/ltertools/articles/ltertools.html","id":"wrangling","dir":"Articles","previous_headings":"Overview","what":"Wrangling","title":"ltertools Vignette","text":"Sometimes convenient read data files specified folder. read offers chance just returns list name element corresponding file name contents list element full data table. Users may specify data format formats wish read . Currently, read supports CSV, TXT, XLS, XLSX files. can demonstrate test CSVs created demonstrate harmonization workflow earlier. Much synthesis work LTER data–indeed many ecological research projects generally–requires quantification variation. end, ’ve written function simply calculates coefficient variation (standard deviation divided mean) vector numbers. sd mean support argument defining missing values handled, cv function well. also included simple function converting temperature values (convert_temp) among different accepted units. Simply specify values convert, current units, units like convert function perform needed arithmetic. Units case-insensitive support either one-letter abbreviation full name unit. Note chose function’s naming convention part allow ecosystem related ‘unit conversion’ functions may prove worthwhile develop.","code":"# Read in all (both) of the CSVs that we created above data_list <- ltertools::read(raw_folder = temp_folder, data_format = \"csv\") # Check the structure of that utils::str(data_list) #> List of 2 #> $ df1.csv:'data.frame': 3 obs. of 3 variables: #> ..$ xx : int [1:3] 1 2 3 #> ..$ unwanted: chr [1:3] \"not\" \"needed\" \"column\" #> ..$ yy : chr [1:3] \"a\" \"b\" \"c\" #> $ df2.csv:'data.frame': 4 obs. of 3 variables: #> ..$ LETTERS: chr [1:4] \"d\" \"e\" \"f\" \"g\" #> ..$ NUMBERS: int [1:4] 4 5 6 7 #> ..$ BONUS : chr [1:4] \"plantae\" \"animalia\" \"fungi\" \"protista\" # Calculate CV (excluding missing values) ltertools::cv(x = c(4, 5, 6, 4, 5, 5), na_rm = TRUE) #> [1] 0.1557461 # Convert some temperatures from F to Kelvin convert_temp(value = c(0, 32, 110), from = \"Fahrenheit\", to = \"k\") #> [1] 255.3722 273.1500 316.4833"},{"path":"https://lter.github.io/ltertools/articles/ltertools.html","id":"lter-information","dir":"Articles","previous_headings":"Overview","what":"LTER Information","title":"ltertools Vignette","text":"LTER Network composed many separate sites. sites “long term” vary slightly created. interested knowing temporal coverage data particular site group sites, site_timeline can prove helpful function. function creates ggplot2 timeline sites vertical axis years horizontal. Lines colored based habitat site support user-defined set hexadecimal colors though default internal palette used. Sites can specified three letter site code sites particular habitat can included. Running function without specifying site codes habitat types result timeline active LTER sites.","code":"# Check the timeline for all grassland or forest LTER sites ltertools::site_timeline(habitats = c(\"grassland\", \"forest\")) # Check the timeline for all LTER sites ltertools::site_timeline()"},{"path":"https://lter.github.io/ltertools/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Nicholas Lyon. Author, maintainer. https://njlyon0.github.io/ Angel Chen. Author. angelchen7.github.io National Science Foundation. Funder. NSF 1929393, 09/01/2019 - 08/31/2024 University California, Santa Barbara. Copyright holder.","code":""},{"path":"https://lter.github.io/ltertools/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Lyon N, Chen (2024). ltertools: Tools Developed Long Term Ecological Research Community. R package version 1.0.0.9000, https://lter.github.io/ltertools/.","code":"@Manual{, title = {ltertools: Tools Developed by the Long Term Ecological Research Community}, author = {Nicholas Lyon and Angel Chen}, year = {2024}, note = {R package version 1.0.0.9000}, url = {https://lter.github.io/ltertools/}, }"},{"path":"https://lter.github.io/ltertools/index.html","id":"ltertools---tools-developed-by-the-long-term-ecological-research-community","dir":"","previous_headings":"","what":"Tools Developed by the Long Term Ecological Research Community","title":"Tools Developed by the Long Term Ecological Research Community","text":"goal ltertools centralize R functions created members Long Term Ecological Research (LTER) community. Many functions likely broad relevance expands beyond context creation package attempt share tools limit amount “re-inventing wheel” silos. conceptual theme functions ltertools necessarily broad given scope community aim serve. said, identity package likely become clear accrue contributed functions. meantime, please hesitate add request function fear doesn’t “fit” package. may eventually become concern stage aiming house extant functions regardless relatedness one another.","code":""},{"path":"https://lter.github.io/ltertools/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Tools Developed by the Long Term Ecological Research Community","text":"can install development version ltertools GitHub :","code":"# install.packages(\"devtools\") devtools::install_github(\"lter/ltertools\")"},{"path":"https://lter.github.io/ltertools/index.html","id":"function-overview","dir":"","previous_headings":"","what":"Function Overview","title":"Tools Developed by the Long Term Ecological Research Community","text":"functions added package briefly summarized attributed author(s)","code":""},{"path":"https://lter.github.io/ltertools/index.html","id":"harmonization","dir":"","previous_headings":"Function Overview","what":"Harmonization","title":"Tools Developed by the Long Term Ecological Research Community","text":"begin_key – creates first two columns ‘column key’ –optional guess_tidy argument set TRUE–“guesses” tidy names ‘’. Function written Nick Lyon harmonize – performs column key-based harmonization. strongly recommend using begin_key start creation column key make sure formatting requirements function met. Function written Nick Lyon","code":""},{"path":"https://lter.github.io/ltertools/index.html","id":"data-wrangling","dir":"","previous_headings":"Function Overview","what":"Data Wrangling","title":"Tools Developed by the Long Term Ecological Research Community","text":"read – Reads files specified types particular folder stores elements list. List element names respective file names. Currently supports CSV, TXT, XLS, XLSX file formats. Function written Nick Lyon cv – Calculate coefficient variation (CV) vector numbers. Function written Nick Lyon convert_temp – Convert temperature values one set units another. Function written Nick Lyon","code":""},{"path":"https://lter.github.io/ltertools/index.html","id":"lter-information","dir":"","previous_headings":"Function Overview","what":"LTER Information","title":"Tools Developed by the Long Term Ecological Research Community","text":"site_timeline – Create timeline sites meet user-specified site code /habitat criteria. Uses built lter_sites data object includes much useful site information. Function written Nick Lyon","code":""},{"path":"https://lter.github.io/ltertools/index.html","id":"contributing","dir":"","previous_headings":"","what":"Contributing","title":"Tools Developed by the Long Term Ecological Research Community","text":"See CONTRIBUTING.md specifics glance: contribute one functions exchange authorship credit: open GitHub issue suggest minor fixes point bugs: open GitHub issue implement major / structural changes: fork repository, add content dev folder, open pull request finished ltertools maintain consistent “feel” style functions (maintainers) happy perform edits behalf. ’d like take care (completely optional!) welcome . Please see CONTRIBUTING.md specific style guide.","code":""},{"path":"https://lter.github.io/ltertools/index.html","id":"synonymous-function-procedure","dir":"","previous_headings":"","what":"Synonymous Function Procedure","title":"Tools Developed by the Long Term Ecological Research Community","text":"like contribute function similar function already exists ltertools please hesitate! event happens, following steps followed: functions combined preserve earlier function’s elements expanding include maximum number novel features (.e., arguments / options) older function’s name retained avoid unnecessary deprecation flags function authors credited combined function’s description README (see )","code":""},{"path":"https://lter.github.io/ltertools/reference/begin_key.html","id":null,"dir":"Reference","previous_headings":"","what":"Generate the Skeleton of a Column Key — begin_key","title":"Generate the Skeleton of a Column Key — begin_key","text":"Creates start 'column key' harmonizing data. column key includes column file names harmonized single data object well column column names files. Finally, includes column indicating tidied name corresponds raw column name. Harmonization can accept key object use reproducibly rename raw column names standardize across datasets. Currently supports raw files following formats: CSV, TXT, XLS, XLSX. function built following authors: Nicholas Lyon","code":""},{"path":"https://lter.github.io/ltertools/reference/begin_key.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Generate the Skeleton of a Column Key — begin_key","text":"","code":"begin_key( raw_folder = NULL, data_format = c(\"csv\", \"txt\", \"xls\", \"xlsx\"), guess_tidy = FALSE )"},{"path":"https://lter.github.io/ltertools/reference/begin_key.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Generate the Skeleton of a Column Key — begin_key","text":"raw_folder (character) folder / folder path containing data files include key data_format (character) file extensions identify within raw_folder. Default behavior search supported file types. guess_tidy (logical) whether attempt \"guess\" tidy name equivalent raw column name. accomplished via coercion lowercase removal special character/repeated characters. FALSE (default) \"tidy_name\" column returned empty","code":""},{"path":"https://lter.github.io/ltertools/reference/begin_key.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Generate the Skeleton of a Column Key — begin_key","text":"(dataframe) skeleton column key","code":""},{"path":"https://lter.github.io/ltertools/reference/begin_key.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Generate the Skeleton of a Column Key — begin_key","text":"","code":"if (FALSE) { # Create a column key from CSV files in a particular folder begin_key(raw_folder = \"raw_data\", data_format = \"csv\", guess_tidy = FALSE) }"},{"path":"https://lter.github.io/ltertools/reference/convert_temp.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert Temperature Values — convert_temp","title":"Convert Temperature Values — convert_temp","text":"Converts given set temperature values one unit another. function built following authors: Nicholas Lyon","code":""},{"path":"https://lter.github.io/ltertools/reference/convert_temp.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert Temperature Values — convert_temp","text":"","code":"convert_temp(value = NULL, from = NULL, to = NULL)"},{"path":"https://lter.github.io/ltertools/reference/convert_temp.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert Temperature Values — convert_temp","text":"value (numeric) temperature values convert (character) starting units value, case sensitive. (character) units convert, case sensitive.","code":""},{"path":"https://lter.github.io/ltertools/reference/convert_temp.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert Temperature Values — convert_temp","text":"(numeric) converted temperature values","code":""},{"path":"https://lter.github.io/ltertools/reference/convert_temp.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Convert Temperature Values — convert_temp","text":"","code":"# Convert from Fahrenheit to Celsius convert_temp(value = 32, from = \"Fahrenheit\", to = \"c\") #> [1] 0"},{"path":"https://lter.github.io/ltertools/reference/cv.html","id":null,"dir":"Reference","previous_headings":"","what":"Calculate Coefficient of Variation — cv","title":"Calculate Coefficient of Variation — cv","text":"Computes coefficient variation (CV), dividing standard deviation (SD) arithmetic mean set numbers. na_rm TRUE missing values removed calculation completed. function built following authors: Nicholas Lyon","code":""},{"path":"https://lter.github.io/ltertools/reference/cv.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Calculate Coefficient of Variation — cv","text":"","code":"cv(x, na_rm = TRUE)"},{"path":"https://lter.github.io/ltertools/reference/cv.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Calculate Coefficient of Variation — cv","text":"x (numeric) vector numbers calculate CV na_rm (logical) whether remove missing values average SD calculation","code":""},{"path":"https://lter.github.io/ltertools/reference/cv.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Calculate Coefficient of Variation — cv","text":"(numeric) coefficient variation","code":""},{"path":"https://lter.github.io/ltertools/reference/cv.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Calculate Coefficient of Variation — cv","text":"","code":"# Convert from Fahrenheit to Celsius cv(x = c(4, 5, 6, 4, 5, 5), na_rm = TRUE) #> [1] 0.1557461"},{"path":"https://lter.github.io/ltertools/reference/harmonize.html","id":null,"dir":"Reference","previous_headings":"","what":"Harmonize Data via a Column Key — harmonize","title":"Harmonize Data via a Column Key — harmonize","text":"\"column key\" meant streamline harmonization disparate datasets. key must include three columns containing: (1) name raw data file harmonized, (2) name columns files, (3) \"tidy name\" corresponds raw column name. function accepts key path folder containing raw data files included key. dataset read original column names replaced respective \"tidy_name\" indicated key. done files, single dataframe returned columns indicated column name. Currently following file formats supported raw data: CSV, TXT, XLS, XLSX. function built following authors: Nicholas Lyon Note raw column names without associated tidy name key removed. recommend using begin_key function package generate skeleton key make achieving required structure simpler.","code":""},{"path":"https://lter.github.io/ltertools/reference/harmonize.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Harmonize Data via a Column Key — harmonize","text":"","code":"harmonize( key = NULL, raw_folder = NULL, data_format = c(\"csv\", \"txt\", \"xls\", \"xlsx\"), quiet = TRUE )"},{"path":"https://lter.github.io/ltertools/reference/harmonize.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Harmonize Data via a Column Key — harmonize","text":"key (dataframe) key object including \"source\", \"raw_name\" \"tidy_name\" column. Additional columns allowed ignored raw_folder (character) folder / folder path containing data files include key data_format (character) file extensions identify within raw_folder. Default behavior search supported file types. quiet (logical) whether suppress certain non-warning messages. Defaults TRUE","code":""},{"path":"https://lter.github.io/ltertools/reference/harmonize.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Harmonize Data via a Column Key — harmonize","text":"(dataframe) harmonized dataframe including columns defined \"tidy_name\" column key object","code":""},{"path":"https://lter.github.io/ltertools/reference/harmonize.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Harmonize Data via a Column Key — harmonize","text":"","code":"if (FALSE) { # Harmonize a set of raw data with a column key ## Note that the `data_format` argument is not specified which defaults to all supported file types harmonize(key = key_object, raw_folder = file.path(\"raw_data\"), quiet = FALSE) }"},{"path":"https://lter.github.io/ltertools/reference/lter_sites.html","id":null,"dir":"Reference","previous_headings":"","what":"Long Term Ecological Research Site Information — lter_sites","title":"Long Term Ecological Research Site Information — lter_sites","text":"currently 28 field sites involved Long Term Ecological Research (LTER) network. sites occupy range habitats started / renewed site-specific timelines. make information readily available interested parties, data object summarizes key components site easy--use data format.","code":""},{"path":"https://lter.github.io/ltertools/reference/lter_sites.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Long Term Ecological Research Site Information — lter_sites","text":"","code":"lter_sites"},{"path":"https://lter.github.io/ltertools/reference/lter_sites.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Long Term Ecological Research Site Information — lter_sites","text":"Dataframe 8 columns 32 rows name Full name LTER site code Abbreviation (typically three letters) site name habitat Simplified habitat designation site (\"mixed\" complex habitat contexts) start_year Year initial funding NSF official LTER site end_year End current funding cycle grant latitude Degrees latitude site longitude Degrees longitude site site_url Website URL site","code":""},{"path":"https://lter.github.io/ltertools/reference/lter_sites.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Long Term Ecological Research Site Information — lter_sites","text":"Long Term Ecological Research Network Office. https://lternet.edu/site/","code":""},{"path":"https://lter.github.io/ltertools/reference/ltertools-package.html","id":null,"dir":"Reference","previous_headings":"","what":"ltertools: Tools Developed by the Long Term Ecological Research Community — ltertools-package","title":"ltertools: Tools Developed by the Long Term Ecological Research Community — ltertools-package","text":"Set data science tools created various members Long Term Ecological Research (LTER) community. functions initially written largely standalone operations later aggregated package.","code":""},{"path":[]},{"path":"https://lter.github.io/ltertools/reference/ltertools-package.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"ltertools: Tools Developed by the Long Term Ecological Research Community — ltertools-package","text":"Maintainer: Nicholas Lyon lyon@nceas.ucsb.edu (ORCID) (https://njlyon0.github.io/) Authors: Angel Chen anchen@nceas.ucsb.edu (ORCID) (angelchen7.github.io) contributors: National Science Foundation (NSF 1929393, 09/01/2019 - 08/31/2024) [funder] University California, Santa Barbara [copyright holder]","code":""},{"path":"https://lter.github.io/ltertools/reference/read.html","id":null,"dir":"Reference","previous_headings":"","what":"Read Data from Folder — read","title":"Read Data from Folder — read","text":"Reads data files specified types found designated folder. Returns list one element data file. Currently supports CSV, TXT, XLS, XLSX. function built following authors: Nicholas Lyon","code":""},{"path":"https://lter.github.io/ltertools/reference/read.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Read Data from Folder — read","text":"","code":"read(raw_folder = NULL, data_format = c(\"csv\", \"txt\", \"xls\", \"xlsx\"))"},{"path":"https://lter.github.io/ltertools/reference/read.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Read Data from Folder — read","text":"raw_folder (character) folder / folder path containing data files read data_format (character) file extensions identify within raw_folder. Default behavior search supported file types.","code":""},{"path":"https://lter.github.io/ltertools/reference/read.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Read Data from Folder — read","text":"(list) data found specified folder specified file format(s)","code":""},{"path":"https://lter.github.io/ltertools/reference/read.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Read Data from Folder — read","text":"","code":"if (FALSE) { # Read in all CSV files in the \"raw_data\" folder df_list <- read(raw_folder = \"raw_data\", data_format = \"csv\") }"},{"path":"https://lter.github.io/ltertools/reference/site_subset.html","id":null,"dir":"Reference","previous_headings":"","what":"Subsets the LTER Site Information Table by Site Codes and Habitats — site_subset","title":"Subsets the LTER Site Information Table by Site Codes and Habitats — site_subset","text":"Subsets information long term ecological research (LTER) sites based user-specified site codes (.e., three letter abbreviations), /desired habitats. See lter_sites full set site information. function built following authors: Nicholas Lyon","code":""},{"path":"https://lter.github.io/ltertools/reference/site_subset.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Subsets the LTER Site Information Table by Site Codes and Habitats — site_subset","text":"","code":"site_subset(sites = NULL, habitats = NULL)"},{"path":"https://lter.github.io/ltertools/reference/site_subset.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Subsets the LTER Site Information Table by Site Codes and Habitats — site_subset","text":"sites (character) three letter site code(s) identifying site(s) interest habitats (character) habitat(s) interest. See unique(lter_sites$habitat)","code":""},{"path":"https://lter.github.io/ltertools/reference/site_subset.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Subsets the LTER Site Information Table by Site Codes and Habitats — site_subset","text":"(dataframe) complete site information (8 columns) sites meet provided site code /habitat criteria","code":""},{"path":"https://lter.github.io/ltertools/reference/site_subset.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Subsets the LTER Site Information Table by Site Codes and Habitats — site_subset","text":"","code":"if (FALSE) { # See only marine or coastal sites site_subset(habitats = c(\"marine\", \"coastal\")) # Return only specified sites site_subset(sites = c(\"AND\", \"NGA\", \"BLE\", \"LNO\")) }"},{"path":"https://lter.github.io/ltertools/reference/site_timeline.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a Timeline of Site(s) that Meet Criteria — site_timeline","title":"Create a Timeline of Site(s) that Meet Criteria — site_timeline","text":"Creates ggplot2 plot sites meet user-specified site code (.e., three letter abbreviation) /habitat criteria. See lter_sites full set site information including accepted site codes habitat designations (unrecognized entries trigger warning ignored). Lines grouped colored habitat better emphasize possible similarities among sites. function built following authors: Nicholas Lyon","code":""},{"path":"https://lter.github.io/ltertools/reference/site_timeline.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a Timeline of Site(s) that Meet Criteria — site_timeline","text":"","code":"site_timeline(sites = NULL, habitats = NULL, colors = NULL)"},{"path":"https://lter.github.io/ltertools/reference/site_timeline.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a Timeline of Site(s) that Meet Criteria — site_timeline","text":"sites (character) three letter site code(s) identifying site(s) interest habitats (character) habitat(s) interest. See unique(lter_sites$habitat) colors (character) colors assign timelines expressed hexadecimal (e.g, #00FF00). Note must many colors habitats included graph","code":""},{"path":"https://lter.github.io/ltertools/reference/site_timeline.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a Timeline of Site(s) that Meet Criteria — site_timeline","text":"(ggplot2) plot object timeline site(s) meet user-specified criteria","code":""},{"path":"https://lter.github.io/ltertools/reference/site_timeline.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a Timeline of Site(s) that Meet Criteria — site_timeline","text":"","code":"# Make the full timeline of all sites with default colors by supplying no arguments site_timeline() # Or make a timeline of only sites that meet certain criteria site_timeline(habitats = c(\"grassland\", \"forest\"))"},{"path":"https://lter.github.io/ltertools/news/index.html","id":"ltertools-version-1009000","dir":"Changelog","previous_headings":"","what":"ltertools Version 1.0.0.9000","title":"ltertools Version 1.0.0.9000","text":"Development version ltertools. ERRORs, WARNINGs, NOTEs returned devtools::check(). Changes latest release listed made. New function: read – reads data files particular folder stores list New function: begin_key – creates start “column key” data harmonization New function: harmonize – performs column key-based harmonization raw data New function: cv – calculates coefficient variation vector numbers New function: convert_temp – converts temperature values one specified unit another New dataset: lter_sites – includes primary habitat, latitude/longitude coordinates, funding start/end years every site currently network","code":""}] +[{"path":"https://lter.github.io/ltertools/CONTRIBUTING.html","id":null,"dir":"","previous_headings":"","what":"Contributing to ltertools","title":"Contributing to ltertools","text":"Please follow contributing instructions relevant subheading consider best contribute ltertools. Thank interest!","code":""},{"path":"https://lter.github.io/ltertools/CONTRIBUTING.html","id":"contributing-a-new-function","dir":"","previous_headings":"","what":"Contributing a New Function","title":"Contributing to ltertools","text":"Adding function ’ve written core ltertools’ reason existing. function ’d like contribute please following: Open GitHub issue paste entirety function issue Please also provide 1-paragraph description function /contexts function invoked description provide sufficient detail R expert can gain fundamental understanding function’s purpose can necessary maintenance integration likely form basis “Description” field function package users can access ?function feel free use existing function’s help file reference (e.g., ?dplyr::filter, etc.) ’ve provided information can work towards standardizing function formatting (casing, syntax, etc.) function can included suite available tools!","code":""},{"path":"https://lter.github.io/ltertools/CONTRIBUTING.html","id":"function-credit","dir":"","previous_headings":"Contributing a New Function","what":"Function Credit","title":"Contributing to ltertools","text":"decide contribute function ltertools offer following benefits: list preferred name DESCRIPTION file author ’d like, can add : email, professional website, link ORCiD also specifically reference description field function(s) contribute taking steps hope ensure intellectual contributions appropriately credited ltertools users can find facets professional work based links R package.","code":""},{"path":"https://lter.github.io/ltertools/CONTRIBUTING.html","id":"minor-edits--suggestions","dir":"","previous_headings":"","what":"Minor Edits / Suggestions","title":"Contributing to ltertools","text":"either (1) calling attention bug/error (2) making small suggestion improvement, suggest open GitHub issue. bugs, please include minimal reproducible example can quickly reproduce resolve bug suggestions, please precise possible know scope changes needed implement idea(s)","code":""},{"path":"https://lter.github.io/ltertools/CONTRIBUTING.html","id":"major-changes","dir":"","previous_headings":"","what":"Major Changes","title":"Contributing to ltertools","text":"major change necessitating systemic/structural changes ltertools recommend following: Fork GitHub repository Add function script (necessary data files) dev folder fork finished edits, submit pull request","code":""},{"path":"https://lter.github.io/ltertools/CONTRIBUTING.html","id":"style-guide","dir":"","previous_headings":"","what":"Style Guide","title":"Contributing to ltertools","text":"happy tweak function/argument names needed maintain concistent “feel” functions ltertools. said, ’d like make changes welcome though aesthetic changes optional. ltertools adhere following stylistic elements: Use “snake case” (.e., lowercase separated underscores) functions arguments (e.g., my_function(argument_1 = ...), etc.) function prints informative messages, include quiet argument accepts logical (.e., TRUE FALSE). quiet = TRUE please suppress messages Include errors / warnings user inputs arguments inappropriate class structure","code":""},{"path":"https://lter.github.io/ltertools/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"BSD 3 Clause License","title":"BSD 3 Clause License","text":"Copyright (c) [], [] Redistribution use source binary forms, without modification, permitted provided following conditions met: SOFTWARE PROVIDED COPYRIGHT HOLDERS CONTRIBUTORS “” EXPRESS IMPLIED WARRANTIES, INCLUDING, LIMITED , IMPLIED WARRANTIES MERCHANTABILITY FITNESS PARTICULAR PURPOSE DISCLAIMED. EVENT SHALL COPYRIGHT HOLDER CONTRIBUTORS LIABLE DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, LIMITED , PROCUREMENT SUBSTITUTE GOODS SERVICES; LOSS USE, DATA, PROFITS; BUSINESS INTERRUPTION) HOWEVER CAUSED THEORY LIABILITY, WHETHER CONTRACT, STRICT LIABILITY, TORT (INCLUDING NEGLIGENCE OTHERWISE) ARISING WAY USE SOFTWARE, EVEN ADVISED POSSIBILITY DAMAGE.","code":"Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of the nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission."},{"path":"https://lter.github.io/ltertools/articles/ltertools.html","id":"overview","dir":"Articles","previous_headings":"","what":"Overview","title":"ltertools Vignette","text":"ltertools package goal ltertools centralize R functions created members Long Term Ecological Research (LTER) community. Many functions likely broad relevance expands beyond context creation package attempt share tools limit amount “re-inventing wheel” silos. conceptual theme functions ltertools necessarily broad given scope community aim serve. said, identity package likely become clear accrue contributed functions. vignette describes main functions ltertools currently exist.","code":"# devtools::install_github(\"lter/ltertools\") library(ltertools)"},{"path":"https://lter.github.io/ltertools/articles/ltertools.html","id":"harmonization","dir":"Articles","previous_headings":"Overview","what":"Harmonization","title":"ltertools Vignette","text":"LTER Network hypothesis-driven focus long term data sites network. results data may reasonably compared –potentially–quite differently formatted based logic investigators responsible dataset. Data harmonization (process resolving formatting inconsistencies facilitate combination/comparison across projects) therefore significant hurdle many projects using LTER data. suggest “column key”-based approach potential greatly simplify harmonization efforts. method requires researchers develop 3-column key contains (1) name raw data file harmonized, (2) name columns files, (3) “tidy name” corresponds raw column name. dataset can read raw names replaced tidy ones specified key. done files specified folder, can combined newly consistent column names. demonstrate workflow, need create example data tables export temporary directory (can read back required harmonization functions). raw data must folder, data key dataframe R allow flexibility user’s end file format / storage (many LTER working groups like generating key collaboratively Google Sheet). example, can generate data key manually . example files key object generated, can now demonstrate actual workflow! fundamental functions harmonize. function requires “column key” described , well folder containing raw data files key refers. Raw data format can also specified CSV, TXT, XLS, /XLSX. quiet argument silence messages key--data mismatches (either expected--missing column names unexpected columns). users want help generating column key, created begin_key function. function accepts raw folder data format arguments included harmonize additional (optional) guess_tidy argument. TRUE, argument attempts “guess” desired tidy name raw column name; standardizing casing removing special characters. may ideal anticipate many raw data files differ casing/special characters rather phrased incompatibly. example ’ll allow key “guess”. visual version column key approach harmonization included convenience :","code":"# Generate two simple tables ## Dataframe 1 df1 <- data.frame(\"xx\" = c(1:3), \"unwanted\" = c(\"not\", \"needed\", \"column\"), \"yy\" = letters[1:3]) ## Dataframe 2 df2 <- data.frame(\"LETTERS\" = letters[4:7], \"NUMBERS\" = c(4:7), \"BONUS\" = c(\"plantae\", \"animalia\", \"fungi\", \"protista\")) # Generate a known temporary folder for exporting temp_folder <- tempdir() # Export both files to that folder utils::write.csv(x = df1, file = file.path(temp_folder, \"df1.csv\"), row.names = FALSE) utils::write.csv(x = df2, file = file.path(temp_folder, \"df2.csv\"), row.names = FALSE) # Generate a key that matches the data we created above key_obj <- data.frame(\"source\" = c(rep(\"df1.csv\", 3), rep(\"df2.csv\", 3)), \"raw_name\" = c(\"xx\", \"unwanted\", \"yy\", \"LETTERS\", \"NUMBERS\", \"BONUS\"), \"tidy_name\" = c(\"numbers\", NA, \"letters\", \"letters\", \"numbers\", \"kingdom\")) # Check that out key_obj #> source raw_name tidy_name #> 1 df1.csv xx numbers #> 2 df1.csv unwanted #> 3 df1.csv yy letters #> 4 df2.csv LETTERS letters #> 5 df2.csv NUMBERS numbers #> 6 df2.csv BONUS kingdom # Use the key to harmonize our example data harmony_df <- ltertools::harmonize(key = key_obj, raw_folder = temp_folder, data_format = \"csv\", quiet = TRUE) # Check the structure of that utils::str(harmony_df) # Generate a column key with \"guesses\" at tidy column names test_key <- ltertools::begin_key(raw_folder = temp_folder, data_format = \"csv\", guess_tidy = TRUE) # Examine what that generated test_key #> source raw_name tidy_name #> 1 df1.csv xx xx #> 2 df1.csv unwanted unwanted #> 3 df1.csv yy yy #> 4 df2.csv LETTERS letters #> 5 df2.csv NUMBERS numbers #> 6 df2.csv BONUS bonus"},{"path":"https://lter.github.io/ltertools/articles/ltertools.html","id":"wrangling","dir":"Articles","previous_headings":"Overview","what":"Wrangling","title":"ltertools Vignette","text":"Sometimes convenient read data files specified folder. read offers chance just returns list name element corresponding file name contents list element full data table. Users may specify data format formats wish read . Currently, read supports CSV, TXT, XLS, XLSX files. can demonstrate test CSVs created demonstrate harmonization workflow earlier. Much synthesis work LTER data–indeed many ecological research projects generally–requires quantification variation. end, ’ve written function simply calculates coefficient variation (standard deviation divided mean) vector numbers. sd mean support argument defining missing values handled, cv function well. also included simple function converting temperature values (convert_temp) among different accepted units. Simply specify values convert, current units, units like convert function perform needed arithmetic. Units case-insensitive support either one-letter abbreviation full name unit. Note chose function’s naming convention part allow ecosystem related ‘unit conversion’ functions may prove worthwhile develop.","code":"# Read in all (both) of the CSVs that we created above data_list <- ltertools::read(raw_folder = temp_folder, data_format = \"csv\") # Check the structure of that utils::str(data_list) #> List of 2 #> $ df1.csv:'data.frame': 3 obs. of 3 variables: #> ..$ xx : int [1:3] 1 2 3 #> ..$ unwanted: chr [1:3] \"not\" \"needed\" \"column\" #> ..$ yy : chr [1:3] \"a\" \"b\" \"c\" #> $ df2.csv:'data.frame': 4 obs. of 3 variables: #> ..$ LETTERS: chr [1:4] \"d\" \"e\" \"f\" \"g\" #> ..$ NUMBERS: int [1:4] 4 5 6 7 #> ..$ BONUS : chr [1:4] \"plantae\" \"animalia\" \"fungi\" \"protista\" # Calculate CV (excluding missing values) ltertools::cv(x = c(4, 5, 6, 4, 5, 5), na_rm = TRUE) #> [1] 0.1557461 # Convert some temperatures from F to Kelvin convert_temp(value = c(0, 32, 110), from = \"Fahrenheit\", to = \"k\") #> [1] 255.3722 273.1500 316.4833"},{"path":"https://lter.github.io/ltertools/articles/ltertools.html","id":"lter-information","dir":"Articles","previous_headings":"Overview","what":"LTER Information","title":"ltertools Vignette","text":"LTER Network composed many separate sites. sites “long term” vary slightly created. interested knowing temporal coverage data particular site group sites, site_timeline can prove helpful function. function creates ggplot2 timeline sites vertical axis years horizontal. Lines colored based habitat site support user-defined set hexadecimal colors though default internal palette used. Sites can specified three letter site code sites particular habitat can included. Running function without specifying site codes habitat types result timeline active LTER sites.","code":"# Check the timeline for all grassland or forest LTER sites ltertools::site_timeline(habitats = c(\"grassland\", \"forest\")) # Check the timeline for all LTER sites ltertools::site_timeline()"},{"path":"https://lter.github.io/ltertools/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Nicholas Lyon. Author, maintainer. https://njlyon0.github.io/ Angel Chen. Author. angelchen7.github.io National Science Foundation. Funder. NSF 1929393, 09/01/2019 - 08/31/2024 University California, Santa Barbara. Copyright holder.","code":""},{"path":"https://lter.github.io/ltertools/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Lyon N, Chen (2024). ltertools: Tools Developed Long Term Ecological Research Community. R package version 1.0.0.9000, https://lter.github.io/ltertools/.","code":"@Manual{, title = {ltertools: Tools Developed by the Long Term Ecological Research Community}, author = {Nicholas Lyon and Angel Chen}, year = {2024}, note = {R package version 1.0.0.9000}, url = {https://lter.github.io/ltertools/}, }"},{"path":"https://lter.github.io/ltertools/index.html","id":"ltertools---tools-developed-by-the-long-term-ecological-research-community","dir":"","previous_headings":"","what":"Tools Developed by the Long Term Ecological Research Community","title":"Tools Developed by the Long Term Ecological Research Community","text":"goal ltertools centralize R functions created members Long Term Ecological Research (LTER) community. Many functions likely broad relevance expands beyond context creation package attempt share tools limit amount “re-inventing wheel” silos. conceptual theme functions ltertools necessarily broad given scope community aim serve. said, identity package likely become clear accrue contributed functions. meantime, please hesitate add request function fear doesn’t “fit” package. may eventually become concern stage aiming house extant functions regardless relatedness one another.","code":""},{"path":"https://lter.github.io/ltertools/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Tools Developed by the Long Term Ecological Research Community","text":"can install development version ltertools GitHub :","code":"# install.packages(\"devtools\") devtools::install_github(\"lter/ltertools\")"},{"path":"https://lter.github.io/ltertools/index.html","id":"function-overview","dir":"","previous_headings":"","what":"Function Overview","title":"Tools Developed by the Long Term Ecological Research Community","text":"functions added package briefly summarized attributed author(s)","code":""},{"path":"https://lter.github.io/ltertools/index.html","id":"harmonization","dir":"","previous_headings":"Function Overview","what":"Harmonization","title":"Tools Developed by the Long Term Ecological Research Community","text":"begin_key – creates first two columns ‘column key’ –optional guess_tidy argument set TRUE–“guesses” tidy names ‘’. Function written Nick Lyon harmonize – performs column key-based harmonization. strongly recommend using begin_key start creation column key make sure formatting requirements function met. Function written Nick Lyon","code":""},{"path":"https://lter.github.io/ltertools/index.html","id":"data-wrangling","dir":"","previous_headings":"Function Overview","what":"Data Wrangling","title":"Tools Developed by the Long Term Ecological Research Community","text":"read – Reads files specified types particular folder stores elements list. List element names respective file names. Currently supports CSV, TXT, XLS, XLSX file formats. Function written Nick Lyon cv – Calculate coefficient variation (CV) vector numbers. Function written Nick Lyon convert_temp – Convert temperature values one set units another. Function written Nick Lyon","code":""},{"path":"https://lter.github.io/ltertools/index.html","id":"lter-information","dir":"","previous_headings":"Function Overview","what":"LTER Information","title":"Tools Developed by the Long Term Ecological Research Community","text":"site_timeline – Create timeline sites meet user-specified site code /habitat criteria. Uses built lter_sites data object includes much useful site information. Function written Nick Lyon","code":""},{"path":"https://lter.github.io/ltertools/index.html","id":"contributing","dir":"","previous_headings":"","what":"Contributing","title":"Tools Developed by the Long Term Ecological Research Community","text":"See CONTRIBUTING.md specifics glance: contribute one functions exchange authorship credit: open GitHub issue suggest minor fixes point bugs: open GitHub issue implement major / structural changes: fork repository, add content dev folder, open pull request finished ltertools maintain consistent “feel” style functions (maintainers) happy perform edits behalf. ’d like take care (completely optional!) welcome . Please see CONTRIBUTING.md specific style guide.","code":""},{"path":"https://lter.github.io/ltertools/index.html","id":"synonymous-function-procedure","dir":"","previous_headings":"","what":"Synonymous Function Procedure","title":"Tools Developed by the Long Term Ecological Research Community","text":"like contribute function similar function already exists ltertools please hesitate! event happens, following steps followed: functions combined preserve earlier function’s elements expanding include maximum number novel features (.e., arguments / options) older function’s name retained avoid unnecessary deprecation flags function authors credited combined function’s description README (see )","code":""},{"path":"https://lter.github.io/ltertools/reference/begin_key.html","id":null,"dir":"Reference","previous_headings":"","what":"Generate the Skeleton of a Column Key — begin_key","title":"Generate the Skeleton of a Column Key — begin_key","text":"Creates start 'column key' harmonizing data. column key includes column file names harmonized single data object well column column names files. Finally, includes column indicating tidied name corresponds raw column name. Harmonization can accept key object use reproducibly rename raw column names standardize across datasets. Currently supports raw files following formats: CSV, TXT, XLS, XLSX. function built following authors: Nicholas Lyon","code":""},{"path":"https://lter.github.io/ltertools/reference/begin_key.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Generate the Skeleton of a Column Key — begin_key","text":"","code":"begin_key( raw_folder = NULL, data_format = c(\"csv\", \"txt\", \"xls\", \"xlsx\"), guess_tidy = FALSE )"},{"path":"https://lter.github.io/ltertools/reference/begin_key.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Generate the Skeleton of a Column Key — begin_key","text":"raw_folder (character) folder / folder path containing data files include key data_format (character) file extensions identify within raw_folder. Default behavior search supported file types. guess_tidy (logical) whether attempt \"guess\" tidy name equivalent raw column name. accomplished via coercion lowercase removal special character/repeated characters. FALSE (default) \"tidy_name\" column returned empty","code":""},{"path":"https://lter.github.io/ltertools/reference/begin_key.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Generate the Skeleton of a Column Key — begin_key","text":"(dataframe) skeleton column key","code":""},{"path":"https://lter.github.io/ltertools/reference/begin_key.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Generate the Skeleton of a Column Key — begin_key","text":"","code":"if (FALSE) { # Create a column key from CSV files in a particular folder begin_key(raw_folder = \"raw_data\", data_format = \"csv\", guess_tidy = FALSE) }"},{"path":"https://lter.github.io/ltertools/reference/convert_temp.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert Temperature Values — convert_temp","title":"Convert Temperature Values — convert_temp","text":"Converts given set temperature values one unit another. function built following authors: Nicholas Lyon","code":""},{"path":"https://lter.github.io/ltertools/reference/convert_temp.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert Temperature Values — convert_temp","text":"","code":"convert_temp(value = NULL, from = NULL, to = NULL)"},{"path":"https://lter.github.io/ltertools/reference/convert_temp.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert Temperature Values — convert_temp","text":"value (numeric) temperature values convert (character) starting units value, case sensitive. (character) units convert, case sensitive.","code":""},{"path":"https://lter.github.io/ltertools/reference/convert_temp.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert Temperature Values — convert_temp","text":"(numeric) converted temperature values","code":""},{"path":"https://lter.github.io/ltertools/reference/convert_temp.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Convert Temperature Values — convert_temp","text":"","code":"# Convert from Fahrenheit to Celsius convert_temp(value = 32, from = \"Fahrenheit\", to = \"c\") #> [1] 0"},{"path":"https://lter.github.io/ltertools/reference/cv.html","id":null,"dir":"Reference","previous_headings":"","what":"Calculate Coefficient of Variation — cv","title":"Calculate Coefficient of Variation — cv","text":"Computes coefficient variation (CV), dividing standard deviation (SD) arithmetic mean set numbers. na_rm TRUE missing values removed calculation completed. function built following authors: Nicholas Lyon","code":""},{"path":"https://lter.github.io/ltertools/reference/cv.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Calculate Coefficient of Variation — cv","text":"","code":"cv(x, na_rm = TRUE)"},{"path":"https://lter.github.io/ltertools/reference/cv.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Calculate Coefficient of Variation — cv","text":"x (numeric) vector numbers calculate CV na_rm (logical) whether remove missing values average SD calculation","code":""},{"path":"https://lter.github.io/ltertools/reference/cv.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Calculate Coefficient of Variation — cv","text":"(numeric) coefficient variation","code":""},{"path":"https://lter.github.io/ltertools/reference/cv.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Calculate Coefficient of Variation — cv","text":"","code":"# Convert from Fahrenheit to Celsius cv(x = c(4, 5, 6, 4, 5, 5), na_rm = TRUE) #> [1] 0.1557461"},{"path":"https://lter.github.io/ltertools/reference/harmonize.html","id":null,"dir":"Reference","previous_headings":"","what":"Harmonize Data via a Column Key — harmonize","title":"Harmonize Data via a Column Key — harmonize","text":"\"column key\" meant streamline harmonization disparate datasets. key must include three columns containing: (1) name raw data file harmonized, (2) name columns files, (3) \"tidy name\" corresponds raw column name. function accepts key path folder containing raw data files included key. dataset read original column names replaced respective \"tidy_name\" indicated key. done files, single dataframe returned columns indicated column name. Currently following file formats supported raw data: CSV, TXT, XLS, XLSX. function built following authors: Nicholas Lyon Note raw column names without associated tidy name key removed. recommend using begin_key function package generate skeleton key make achieving required structure simpler.","code":""},{"path":"https://lter.github.io/ltertools/reference/harmonize.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Harmonize Data via a Column Key — harmonize","text":"","code":"harmonize( key = NULL, raw_folder = NULL, data_format = c(\"csv\", \"txt\", \"xls\", \"xlsx\"), quiet = TRUE )"},{"path":"https://lter.github.io/ltertools/reference/harmonize.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Harmonize Data via a Column Key — harmonize","text":"key (dataframe) key object including \"source\", \"raw_name\" \"tidy_name\" column. Additional columns allowed ignored raw_folder (character) folder / folder path containing data files include key data_format (character) file extensions identify within raw_folder. Default behavior search supported file types. quiet (logical) whether suppress certain non-warning messages. Defaults TRUE","code":""},{"path":"https://lter.github.io/ltertools/reference/harmonize.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Harmonize Data via a Column Key — harmonize","text":"(dataframe) harmonized dataframe including columns defined \"tidy_name\" column key object","code":""},{"path":"https://lter.github.io/ltertools/reference/harmonize.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Harmonize Data via a Column Key — harmonize","text":"","code":"if (FALSE) { # Harmonize a set of raw data with a column key ## Note that the `data_format` argument is not specified which defaults to all supported file types harmonize(key = key_object, raw_folder = file.path(\"raw_data\"), quiet = FALSE) }"},{"path":"https://lter.github.io/ltertools/reference/lter_sites.html","id":null,"dir":"Reference","previous_headings":"","what":"Long Term Ecological Research Site Information — lter_sites","title":"Long Term Ecological Research Site Information — lter_sites","text":"currently 28 field sites involved Long Term Ecological Research (LTER) network. sites occupy range habitats started / renewed site-specific timelines. make information readily available interested parties, data object summarizes key components site easy--use data format.","code":""},{"path":"https://lter.github.io/ltertools/reference/lter_sites.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Long Term Ecological Research Site Information — lter_sites","text":"","code":"lter_sites"},{"path":"https://lter.github.io/ltertools/reference/lter_sites.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Long Term Ecological Research Site Information — lter_sites","text":"Dataframe 8 columns 32 rows name Full name LTER site code Abbreviation (typically three letters) site name habitat Simplified habitat designation site (\"mixed\" complex habitat contexts) start_year Year initial funding NSF official LTER site end_year End current funding cycle grant latitude Degrees latitude site longitude Degrees longitude site site_url Website URL site","code":""},{"path":"https://lter.github.io/ltertools/reference/lter_sites.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Long Term Ecological Research Site Information — lter_sites","text":"Long Term Ecological Research Network Office. https://lternet.edu/site/","code":""},{"path":"https://lter.github.io/ltertools/reference/ltertools-package.html","id":null,"dir":"Reference","previous_headings":"","what":"ltertools: Tools Developed by the Long Term Ecological Research Community — ltertools-package","title":"ltertools: Tools Developed by the Long Term Ecological Research Community — ltertools-package","text":"Set data science tools created various members Long Term Ecological Research (LTER) community. functions initially written largely standalone operations later aggregated package.","code":""},{"path":[]},{"path":"https://lter.github.io/ltertools/reference/ltertools-package.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"ltertools: Tools Developed by the Long Term Ecological Research Community — ltertools-package","text":"Maintainer: Nicholas Lyon lyon@nceas.ucsb.edu (ORCID) (https://njlyon0.github.io/) Authors: Angel Chen anchen@nceas.ucsb.edu (ORCID) (angelchen7.github.io) contributors: National Science Foundation (NSF 1929393, 09/01/2019 - 08/31/2024) [funder] University California, Santa Barbara [copyright holder]","code":""},{"path":"https://lter.github.io/ltertools/reference/read.html","id":null,"dir":"Reference","previous_headings":"","what":"Read Data from Folder — read","title":"Read Data from Folder — read","text":"Reads data files specified types found designated folder. Returns list one element data file. Currently supports CSV, TXT, XLS, XLSX. function built following authors: Nicholas Lyon","code":""},{"path":"https://lter.github.io/ltertools/reference/read.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Read Data from Folder — read","text":"","code":"read(raw_folder = NULL, data_format = c(\"csv\", \"txt\", \"xls\", \"xlsx\"))"},{"path":"https://lter.github.io/ltertools/reference/read.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Read Data from Folder — read","text":"raw_folder (character) folder / folder path containing data files read data_format (character) file extensions identify within raw_folder. Default behavior search supported file types.","code":""},{"path":"https://lter.github.io/ltertools/reference/read.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Read Data from Folder — read","text":"(list) data found specified folder specified file format(s)","code":""},{"path":"https://lter.github.io/ltertools/reference/read.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Read Data from Folder — read","text":"","code":"if (FALSE) { # Read in all CSV files in the \"raw_data\" folder df_list <- read(raw_folder = \"raw_data\", data_format = \"csv\") }"},{"path":"https://lter.github.io/ltertools/reference/site_subset.html","id":null,"dir":"Reference","previous_headings":"","what":"Subsets the LTER Site Information Table by Site Codes and Habitats — site_subset","title":"Subsets the LTER Site Information Table by Site Codes and Habitats — site_subset","text":"Subsets information long term ecological research (LTER) sites based user-specified site codes (.e., three letter abbreviations), /desired habitats. See lter_sites full set site information. function built following authors: Nicholas Lyon","code":""},{"path":"https://lter.github.io/ltertools/reference/site_subset.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Subsets the LTER Site Information Table by Site Codes and Habitats — site_subset","text":"","code":"site_subset(sites = NULL, habitats = NULL)"},{"path":"https://lter.github.io/ltertools/reference/site_subset.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Subsets the LTER Site Information Table by Site Codes and Habitats — site_subset","text":"sites (character) three letter site code(s) identifying site(s) interest habitats (character) habitat(s) interest. See unique(lter_sites$habitat)","code":""},{"path":"https://lter.github.io/ltertools/reference/site_subset.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Subsets the LTER Site Information Table by Site Codes and Habitats — site_subset","text":"(dataframe) complete site information (8 columns) sites meet provided site code /habitat criteria","code":""},{"path":"https://lter.github.io/ltertools/reference/site_subset.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Subsets the LTER Site Information Table by Site Codes and Habitats — site_subset","text":"","code":"if (FALSE) { # See only marine or coastal sites site_subset(habitats = c(\"marine\", \"coastal\")) # Return only specified sites site_subset(sites = c(\"AND\", \"NGA\", \"BLE\", \"LNO\")) }"},{"path":"https://lter.github.io/ltertools/reference/site_timeline.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a Timeline of Site(s) that Meet Criteria — site_timeline","title":"Create a Timeline of Site(s) that Meet Criteria — site_timeline","text":"Creates ggplot2 plot sites meet user-specified site code (.e., three letter abbreviation) /habitat criteria. See lter_sites full set site information including accepted site codes habitat designations (unrecognized entries trigger warning ignored). Lines grouped colored habitat better emphasize possible similarities among sites. function built following authors: Nicholas Lyon","code":""},{"path":"https://lter.github.io/ltertools/reference/site_timeline.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a Timeline of Site(s) that Meet Criteria — site_timeline","text":"","code":"site_timeline(sites = NULL, habitats = NULL, colors = NULL)"},{"path":"https://lter.github.io/ltertools/reference/site_timeline.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a Timeline of Site(s) that Meet Criteria — site_timeline","text":"sites (character) three letter site code(s) identifying site(s) interest habitats (character) habitat(s) interest. See unique(lter_sites$habitat) colors (character) colors assign timelines expressed hexadecimal (e.g, #00FF00). Note must many colors habitats included graph","code":""},{"path":"https://lter.github.io/ltertools/reference/site_timeline.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a Timeline of Site(s) that Meet Criteria — site_timeline","text":"(ggplot2) plot object timeline site(s) meet user-specified criteria","code":""},{"path":"https://lter.github.io/ltertools/reference/site_timeline.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a Timeline of Site(s) that Meet Criteria — site_timeline","text":"","code":"# Make the full timeline of all sites with default colors by supplying no arguments site_timeline() # Or make a timeline of only sites that meet certain criteria site_timeline(habitats = c(\"grassland\", \"forest\"))"},{"path":"https://lter.github.io/ltertools/news/index.html","id":"ltertools-version-1009000","dir":"Changelog","previous_headings":"","what":"ltertools Version 1.0.0.9000","title":"ltertools Version 1.0.0.9000","text":"Development version ltertools. ERRORs, WARNINGs, NOTEs returned devtools::check(). Changes latest release listed made. New function: read – reads data files particular folder stores list New function: begin_key – creates start “column key” data harmonization New function: harmonize – performs column key-based harmonization raw data New function: cv – calculates coefficient variation vector numbers New function: convert_temp – converts temperature values one specified unit another New dataset: lter_sites – includes primary habitat, latitude/longitude coordinates, funding start/end years every site currently network","code":""}]