From 10a73a9bc44a90a6ffb731702cc5697b83e1883c Mon Sep 17 00:00:00 2001 From: danielvartan Date: Tue, 1 Oct 2024 09:42:38 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20danielva?= =?UTF-8?q?rtan/groomr@85133299194b918f2dbbd82637c0998e1b319543=20?= =?UTF-8?q?=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- authors.html | 4 +- index.html | 8 +- pkgdown.yml | 2 +- reference/blank_line_neighbors.html | 6 +- reference/cutter.html | 240 ++++++++++++++++++++++++++ reference/groomr-package.html | 4 +- reference/index.html | 38 ++-- reference/normalize_extdata.html | 110 ++++++++++++ reference/normalize_hashtags.html | 6 +- reference/remove_blank_line_dups.html | 17 +- reference/replace_pattern.html | 7 +- reference/split_by_pattern.html | 24 +-- reference/split_file.html | 6 +- sitemap.xml | 2 + 14 files changed, 421 insertions(+), 53 deletions(-) create mode 100644 reference/cutter.html create mode 100644 reference/normalize_extdata.html diff --git a/authors.html b/authors.html index a8e8563..45fe495 100644 --- a/authors.html +++ b/authors.html @@ -61,9 +61,9 @@

Citation

-

Vartanian, D. (2024). {groomr}: tools to tidy text files. R package. https://danielvartan.github.io/groomr/

+

Vartanian, D. (2024). {groomr}: tools to tidy strings and text files. R package. https://danielvartan.github.io/groomr/

@Unpublished{,
-  title = {{groomr}: tools to tidy text files},
+  title = {{groomr}: tools to tidy strings and text files},
   author = {Daniel Vartanian},
   year = {2024},
   url = {https://danielvartan.github.io/groomr/},
diff --git a/index.html b/index.html
index cbdf3d9..3e8fbc9 100644
--- a/index.html
+++ b/index.html
@@ -5,13 +5,13 @@
 
 
 
-Tools to Tidy Text Files • groomr
+Tools to Tidy Strings and Text Files • groomr
 
 
 
 
 
-
+
 
 Identify blank lines around a line — blank_line_neighbors • groomrIdentify blank lines around a line — blank_line_neighbors • groomrCut a vector into pieces — cutter • groomr
+
+
+    
+
+ + + +
+
+ + +
+

[Experimental]

+

cutter() cut vectors into pieces by cutting points/indexes.

+
+ +
+
cutter(x, index, between = NULL, rm_start = FALSE, rm_end = FALSE)
+
+ +
+

Arguments

+ + +
x
+

An atomic vector (e.g., +character, integer, numeric, factor, POSIXct).

+ + +
index
+

An integerish numeric object +or an integer object with the indexes/cutting points.

+ + +
between
+

(optional) A string object indicating the direction of the cut +(choices: "left", "right"). This argument only need to be assigned if +the cut must be performed between the indexes values (default: NULL).

+ + +
rm_start
+

(optional) a logical value indicating if +the start element of the cut must be removed (default: FALSE).

+ + +
rm_end
+

(optional) a logical value indicating if +the end element of the cut must be removed (default: FALSE).

+ +
+
+

Value

+

A list object with the cut pieces as elements.

+
+
+

Details

+

cutter() can perform different kinds of cuts. Here are some examples.

+

Cutting by index values

+ + +

cutter(seq(10), c(3, 9))
+
+   cut         cut
+    |           |
+1 2 3 4 5 6 7 8 9 10
+
+Element 1: 1, 2
+Element 2: 4, 5, 6, 7, 8
+Element 3: 10

+
+ +
+

Cutting between index values

+ + +

cutter(seq(10), c(3, 9), between = "left")
+
+  cut         cut
+   |           |
+1 2 3 4 5 6 7 8 9 10
+
+Element 1: 1, 2
+Element 2: 3, 4, 5, 6, 7, 8
+Element 3: 9, 10

+

cutter(seq(10), c(3, 9), between = "right")
+
+    cut         cut
+     |           |
+1 2 3 4 5 6 7 8 9 10
+
+Element 1: 1, 2, 3
+Element 2: 4, 5, 6, 7, 8, 9
+Element 3: 10

+
+ +
+

Removing tips

+ + +

cutter(seq(20), c(7, 16), rm_start = TRUE, rm_end = TRUE)
+
+           cut                      cut
+            |                        |
+1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
+|---------|                            |---------|
+ start tip                               end tip
+
+Element 1: 8, 9, 10, 11, 12, 13, 14, 15

+
+ +
+
+

See also

+

Other string functions: +replace_pattern(), +split_by_pattern()

+
+ +
+

Examples

+
## Cutting by index values
+
+cutter(seq(10), c(3, 9))
+#> [[1]]
+#> [1] 1 2
+#> 
+#> [[2]]
+#> [1] 4 5 6 7 8
+#> 
+#> [[3]]
+#> [1] 10
+#> 
+
+## Cutting between index values
+
+cutter(seq(10), c(3, 9), between = "left")
+#> [[1]]
+#> [1] 1 2
+#> 
+#> [[2]]
+#> [1] 3 4 5 6 7 8
+#> 
+#> [[3]]
+#> [1]  9 10
+#> 
+
+cutter(seq(10), c(3, 9), between = "right")
+#> [[1]]
+#> [1] 1 2 3
+#> 
+#> [[2]]
+#> [1] 4 5 6 7 8 9
+#> 
+#> [[3]]
+#> [1] 10
+#> 
+
+## Removing start or end tips
+
+cutter(seq(10), c(3, 9), rm_start = TRUE)
+#> [[1]]
+#> [1] 4 5 6 7 8
+#> 
+#> [[2]]
+#> [1] 10
+#> 
+
+cutter(seq(10), c(3, 9), rm_end = TRUE)
+#> [[1]]
+#> [1] 1 2
+#> 
+#> [[2]]
+#> [1] 4 5 6 7 8
+#> 
+
+
+
+ +
+ + +
+ + + + + + + + diff --git a/reference/groomr-package.html b/reference/groomr-package.html index 18f2286..843d09e 100644 --- a/reference/groomr-package.html +++ b/reference/groomr-package.html @@ -1,5 +1,5 @@ -groomr: Tools to Tidy Text Files — groomr-package • groomrgroomr: Tools to Tidy Strings and Text Files — groomr-package • groomr @@ -43,7 +43,7 @@
diff --git a/reference/index.html b/reference/index.html index 49f1f21..a5957a2 100644 --- a/reference/index.html +++ b/reference/index.html @@ -47,18 +47,34 @@

Reference

- + + + + + + + + @@ -67,25 +83,21 @@

Strings

-

Tags

+

Cleaning

-

normalize_hashtags()

+

blank_line_neighbors()

Normalize hashtags inside files

Identify blank lines around a line

+

remove_blank_line_dups()

+

Remove blank line duplicates from a file

+

Files

+

+
+

split_file()

+

Split files into parts

Strings

+

cutter()

+

Cut a vector into pieces

replace_pattern()

Replace patterns inside files

Split a character vector by a pattern

-

Cleaning

+

R packages

-

blank_line_neighbors()

+

normalize_extdata()

Identify blank lines around a line

-

remove_blank_line_dups()

-

Remove blank line duplicates from a file

Normalize file names from the extdata folder

-

Others

+

Tags

-

split_file()

+

normalize_hashtags()

Split files into parts

Normalize hashtags inside files

-

This function removes blank line duplicates (e.g., a "" line, followed by +

[Experimental]

+

This function removes blank line duplicates (e.g., a "" line, followed by another "" line) from a file.

+

It can also remove blank lines at the top or bottom of the file, and remove +blank lines around a text block.

@@ -94,11 +100,6 @@

Arguments

Value

An invisible NULL. This function don't aim to return values.

-
-

Details

-

It can also remove blank lines at the top or bottom of the file, and remove -blank lines around a text block.

-

Examples

diff --git a/reference/replace_pattern.html b/reference/replace_pattern.html index 20aeceb..f9e483b 100644 --- a/reference/replace_pattern.html +++ b/reference/replace_pattern.html @@ -1,5 +1,6 @@ -Replace patterns inside files — replace_pattern • groomrReplace patterns inside files — replace_pattern • groomrSplit a character vector by a pattern — split_by_pattern • groomrSplit a character vector by a pattern — split_by_pattern • groomrSplit files into parts — split_file • groomrSplit files into parts — split_file • groomr @@ -49,7 +50,8 @@

Split files into parts

-

split_file() split a single file into n parts.

+

[Experimental]

+

split_file() split a single file into n parts.

diff --git a/sitemap.xml b/sitemap.xml index 5f93d27..2f47bbf 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -8,8 +8,10 @@ https://danielvartan.github.io/groomr/index.html https://danielvartan.github.io/groomr/news/index.html https://danielvartan.github.io/groomr/reference/blank_line_neighbors.html +https://danielvartan.github.io/groomr/reference/cutter.html https://danielvartan.github.io/groomr/reference/groomr-package.html https://danielvartan.github.io/groomr/reference/index.html +https://danielvartan.github.io/groomr/reference/normalize_extdata.html https://danielvartan.github.io/groomr/reference/normalize_hashtags.html https://danielvartan.github.io/groomr/reference/remove_blank_line_dups.html https://danielvartan.github.io/groomr/reference/replace_pattern.html