End String with Full Stop and no Other Punctuation or Spaces.
endstop.Rdendstop() removes all punctuation and spaces from the end of a string and optionally terminates the
string with a full stop.
endstop_data() removes all punctuation and spaces from the end of selected strings in .data and
optionally terminates the strings with full stops.
Arguments
- string
 a character vector of length one.
- .stop
 logical. Whether or not to add a full stop at the end of the string; defaultTRUE.- .data
 a data frame, or a data frame extension (e.g. a
tibble).- ...
 <
tidy-select> character columns in .data toendstop.
Value
For endstop(), a character vector of length one, optionally terminating in a full stop. For
endstop_data(), a tibble derived from .data, with selected character
columns modified by endstop().
Details
Uses str_detect from package stringr to detect the regular
expressions '[:punct:]' and '[:space:]', and str_sub to modify the string.
For endstop_data(), character columns in .data are selected using ... with the
<tidy-select> syntax of package dplyr, including use of
selection helpers and modified by endstop(). If no character columns are selected in ...,
all character columns in .data will be modified  by endstop().
See also
Other utils:
const(),
marker(),
op-min-max,
revmat()
Examples
"Mimiland" |> endstop()
#> [1] "Mimiland."
"Mimiland." |> endstop(FALSE)
#> [1] "Mimiland"
"Mimiland," |> endstop()
#> [1] "Mimiland."
"Mimiland ." |> endstop()
#> [1] "Mimiland."
"Mimiland. " |> endstop()
#> [1] "Mimiland."
s <- "Mimiland.!?\\(){}"
cat(s)
#> Mimiland.!?\(){}
endstop(s)
#> [1] "Mimiland."
s <- "Mimiland . ! ? \\ ( ) { } "
cat(s)
#> Mimiland . ! ? \ ( ) { } 
endstop(s, FALSE)
#> [1] "Mimiland"
starwars3 |> endstop_data(name)
#> # A tibble: 10 × 2
#>    name                   skin_color         
#>    <chr>                  <chr>              
#>  1 Ackbar.                brown mottle       
#>  2 Ben Quadinaros.        grey, green, yellow
#>  3 Gasgano.               white, blue        
#>  4 Grievous.              brown, white       
#>  5 Jabba Desilijic Tiure. green-tan, brown   
#>  6 Nute Gunray.           mottled green      
#>  7 R2-D2.                 white, blue        
#>  8 R4-P17.                silver, red        
#>  9 Shaak Ti.              red, blue, white   
#> 10 Zam Wesell.            fair, green, yellow
starwars3 |> endstop_data(starts_with("sk"))
#> # A tibble: 10 × 2
#>    name                  skin_color          
#>    <chr>                 <chr>               
#>  1 Ackbar                brown mottle.       
#>  2 Ben Quadinaros        grey, green, yellow.
#>  3 Gasgano               white, blue.        
#>  4 Grievous              brown, white.       
#>  5 Jabba Desilijic Tiure green-tan, brown.   
#>  6 Nute Gunray           mottled green.      
#>  7 R2-D2                 white, blue.        
#>  8 R4-P17                silver, red.        
#>  9 Shaak Ti              red, blue, white.   
#> 10 Zam Wesell            fair, green, yellow.
starwars3 |> endstop_data()
#> endstop_data(): no character variables selected in ...; processing all character variables in .data.
#> # A tibble: 10 × 2
#>    name                   skin_color          
#>    <chr>                  <chr>               
#>  1 Ackbar.                brown mottle.       
#>  2 Ben Quadinaros.        grey, green, yellow.
#>  3 Gasgano.               white, blue.        
#>  4 Grievous.              brown, white.       
#>  5 Jabba Desilijic Tiure. green-tan, brown.   
#>  6 Nute Gunray.           mottled green.      
#>  7 R2-D2.                 white, blue.        
#>  8 R4-P17.                silver, red.        
#>  9 Shaak Ti.              red, blue, white.   
#> 10 Zam Wesell.            fair, green, yellow.
rm(s)