From 3ddd1c89db06fb820dbfe59a6141c1e7b6d2bdae Mon Sep 17 00:00:00 2001
From: maurolepore
Date: Tue, 15 May 2018 17:24:14 -0400
Subject: [PATCH] Update docs.
---
NEWS.md | 2 +-
docs/articles/read_df_write.html | 2 +-
docs/news/index.html | 3 +-
docs/reference/fieldforms_output.html | 8 +--
docs/reference/xl_sheets_to_output.html | 79 ++++++++++++++++++++++---
5 files changed, 80 insertions(+), 14 deletions(-)
diff --git a/NEWS.md b/NEWS.md
index 700e9550..e5be843d 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,6 +1,6 @@
# fgeo.tool 0.0.0.9002
-* `xl_sheets_to_csv()` and friends gain the argument `first_census` to now accept first census data.
+* `xl_sheets_to_*()` gain the argument `first_census` (Sabrina Russo, #31).
* Clarify the internal structure of fgeo.tool with function's prefixes.
* `add_*()`
diff --git a/docs/articles/read_df_write.html b/docs/articles/read_df_write.html
index 1a97e237..60efd3f5 100644
--- a/docs/articles/read_df_write.html
+++ b/docs/articles/read_df_write.html
@@ -91,7 +91,7 @@
Read, combine, identify, and write multiple files
Mauro Lepore
- 2018-05-14
+ 2018-05-15
Source: vignettes/read_df_write.Rmd
read_df_write.Rmd
diff --git a/docs/news/index.html b/docs/news/index.html
index 9d0a8865..19dfb67d 100644
--- a/docs/news/index.html
+++ b/docs/news/index.html
@@ -123,6 +123,7 @@ Changelog
#> output file: forms_loop.knit.md
#> "C:/Users/LeporeM/AppData/Local/Pandoc/pandoc" +RTS -K512m -RTS forms_loop.utf8.md --to docx --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash+smart --output pandoc1b586e435ca.docx --highlight-style tango --reference-doc reference.docx
#>
-#> Output created: C:/Users/LeporeM/AppData/Local/Temp/1/Rtmpuu17B4/fieldforms.docx
fieldforms_output(
+#>
#> output file: forms_loop.knit.md
#> "C:/Users/LeporeM/AppData/Local/Pandoc/pandoc" +RTS -K512m -RTS forms_loop.utf8.md --to docx --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash+smart --output pandoc21cc60b24f5.docx --highlight-style tango --reference-doc reference.docx
#>
+#> Output created: C:/Users/LeporeM/AppData/Local/Temp/1/RtmpoFtUKz/fieldforms.docx
fieldforms_output(
prep, "fieldforms2.docx", header = "Custom Header", output_dir = tmp
)
#>
#>
@@ -270,8 +270,8 @@
Examp
#>
|
|.................................................................| 100%
#> ordinary text without R code
#>
-#>
#> output file: forms_loop.knit.md
#> "C:/Users/LeporeM/AppData/Local/Pandoc/pandoc" +RTS -K512m -RTS forms_loop.utf8.md --to docx --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash+smart --output pandoc1b5813897950.docx --highlight-style tango --reference-doc reference.docx
#>
-#> Output created: C:/Users/LeporeM/AppData/Local/Temp/1/Rtmpuu17B4/fieldforms2.docx
+#>
#> output file: forms_loop.knit.md
#> "C:/Users/LeporeM/AppData/Local/Pandoc/pandoc" +RTS -K512m -RTS forms_loop.utf8.md --to docx --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash+smart --output pandoc21cc63c35d0.docx --highlight-style tango --reference-doc reference.docx
#>
+#> Output created: C:/Users/LeporeM/AppData/Local/Temp/1/RtmpoFtUKz/fieldforms2.docx
# Confirm
dir(tmp)[grepl("docx$", dir(tmp))]
#> [1] "fieldforms.docx" "fieldforms2.docx"
# Cleaning temporary directory
diff --git a/docs/reference/xl_sheets_to_output.html b/docs/reference/xl_sheets_to_output.html
index 11f846d6..91390ce8 100644
--- a/docs/reference/xl_sheets_to_output.html
+++ b/docs/reference/xl_sheets_to_output.html
@@ -137,11 +137,11 @@
Combine spreadsheets from excel workbooks and output common data structures.
- xl_sheets_to_csv(input_dir, output_dir = "./")
+ xl_sheets_to_csv(input_dir, output_dir = "./", first_census = FALSE)
-xl_sheets_to_xl(input_dir, output_dir = "./")
+xl_sheets_to_xl(input_dir, output_dir = "./", first_census = FALSE)
-xl_sheets_to_df(input_dir)
+xl_sheets_to_df(input_dir, first_census = FALSE)
Arguments
@@ -155,6 +155,18 @@ Arg
output_dir |
String giving the directory where to write .csv files to. |
+
+ first_census |
+ This argument tells these functions what sheets to expect
+in the input.
+Use TRUE if this is your first census. The expected input must have
+sheets (1) "root", (2) "multi_stems", (3) "secondary_stems", and
+(4) "single_stems".
+Use FALSE (default) if this is not your first census. The expected
+input must have sheets (1) "root", (2) "original_stems", (3)
+"new_secondary_stems", and (4) "recruits".
+ |
+
Value
@@ -168,8 +180,8 @@ Details
function does:
Reads each spreadsheet from each workbook and map it to a dataframe.
Lowercases and links the names of each dataframe.
-Keeps only these dataframes: (1) original_stems; (2) new_secondary_stems;
-and (3).
+Keeps only these dataframes: (1) original_stems, (2) new_secondary_stems,
+and (3) "recruits".
Dates the data by submission_id
(date
comes from the spreadsheet
root
).
Lowercases and links the names of each dataframe-variable.
@@ -177,10 +189,18 @@ Details
Output a common data structure of your choice.
+ Acknowledgment
+
+
+ Sabrina Russo helped to make these functions useful with first censuses.
+
Examples
#> [1] "C:/Users/LeporeM/Dropbox/git_repos/fgeo.tool/inst/extdata/two_files"
#> new_stem_1.csv new_stem_2.csv
+path_file(dir_ls(output_dir, regexp = "new_stem.*csv$"))#> new_stem_1.csv new_stem_2.csv
#> Warning: `.x` has no dataframe new_secondary_stems
#> Warning: `.x` has no dataframe recruits
#> $census.xlsx
+#> # A tibble: 49 x 15
+#> submission_id quadrat tag stem_tag species species_code dbh status codes
+#> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
+#> 1 c01b37d5-2c3~ 0816 007 1 Americ~ TILIAM 51.2 LI M
+#> 2 efd8e991-2e3~ 0916 004 1 Americ~ TILIAM 31.6 LI M
+#> 3 efd8e991-2e3~ 0916 007 1 Ironwo~ OSTRVI 10.2 LI M
+#> 4 efd8e991-2e3~ 0916 008 1 Ironwo~ OSTRVI 2.7 LI M;L
+#> 5 efd8e991-2e3~ 0916 010 1 Hackbe~ CELTOC 25.9 LI M
+#> 6 efd8e991-2e3~ 0916 012 1 Bur Oak QUERMA 35.2 LI M;FS~
+#> 7 7997596a-c94~ 1017 001 1 Americ~ TILIAM 65.3 LI M;FS~
+#> 8 572ddae1-d02~ 0816 002 1 Hackbe~ CELTOC 45.1 LI M
+#> 9 c01b37d5-2c3~ 0816 007 2 TILIAM <NA> 42.4 LI S;L
+#> 10 c01b37d5-2c3~ 0816 007 3 TILIAM <NA> 39.8 LI S
+#> # ... with 39 more rows, and 6 more variables: notes <chr>, pom <chr>,
+#> # sheet <chr>, section_id <chr>, unique_stem <chr>, date <chr>
+#>
+# Output excel
+xl_sheets_to_xl(input_dir, output_dir, first_census = TRUE)
#> Warning: `.x` has no dataframe new_secondary_stems
#> Warning: `.x` has no dataframe recruits
#> Classes ‘tbl_df’, ‘tbl’ and 'data.frame': 49 obs. of 15 variables:
+#> $ submission_id: chr "c01b37d5-2c30-4086-b4a1-78327dfa0a9a" "efd8e991-2e34-40c8-b503-44def6e542d9" "efd8e991-2e34-40c8-b503-44def6e542d9" "efd8e991-2e34-40c8-b503-44def6e542d9" ...
+#> $ quadrat : chr "0816" "0916" "0916" "0916" ...
+#> $ tag : chr "007" "004" "007" "008" ...
+#> $ stem_tag : chr "1" "1" "1" "1" ...
+#> $ species : chr "American Basswood/Linden" "American Basswood/Linden" "Ironwood" "Ironwood" ...
+#> $ species_code : chr "TILIAM" "TILIAM" "OSTRVI" "OSTRVI" ...
+#> $ dbh : chr "51.2" "31.6" "10.2" "2.7" ...
+#> $ status : chr "LI" "LI" "LI" "LI" ...
+#> $ codes : chr "M" "M" "M" "M;L" ...
+#> $ notes : chr NA NA NA "In brush pile" ...
+#> $ pom : chr "1.3" "1.3" "1.3" "1.3" ...
+#> $ sheet : chr "multi_stems" "multi_stems" "multi_stems" "multi_stems" ...
+#> $ section_id : chr NA NA NA NA ...
+#> $ unique_stem : chr "007_1" "004_1" "007_1" "008_1" ...
+#> $ date : chr "2018.05.14" "2018.05.14" "2018.05.14" "2018.05.14" ...