Skip to content

Commit 13d09bd

Browse files
author
mo2-amodu
committed
updated code repo for CRAN
1 parent 96e8d88 commit 13d09bd

File tree

7 files changed

+26
-20
lines changed

7 files changed

+26
-20
lines changed

R/forstringr-package.R

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
"_PACKAGE"
33

44
## usethis namespace: start
5-
#' @importFrom dplyr %>%
6-
#' @importFrom dplyr across
7-
#' @importFrom dplyr mutate
5+
#' @importFrom dplyr %>% across mutate
86
#' @importFrom stats na.omit
97
#' @importFrom stringr str_to_title
108
## usethis namespace: end

R/ignore_unused_imports.R

Lines changed: 0 additions & 5 deletions
This file was deleted.

R/str_title_case.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#' @inheritParams stringr::str_to_title
1111
#'
1212
#' @return
13-
#' A character vector the same length as the string and in the title case.
13+
#' A character vector the same length as the string and in title case.
1414
#'
1515
#' @export
1616
#'

README.Rmd

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,12 @@ library(forstringr)
7979
8080
ethnicity <- c("Hausa", NA, "Yoruba", "Ijaw", "Igbo", NA, "Ibibio", "Tiv", "Fulani", "Kanuri", "Others")
8181
82-
length(ethnicity) # Count all the observations, including the NAs.
82+
# count all the observations, including NAs.
83+
84+
length(ethnicity)
85+
86+
87+
# count all the observations, without NAs.
8388
8489
length_omit_na(ethnicity)
8590
```
@@ -171,13 +176,14 @@ It is important to note that `str_englue()` must be used inside a function. `str
171176
library(ggplot2)
172177
173178
histogram_plot <- function(df, var, binwidth) {
174-
df |>
179+
df %>%
175180
ggplot(aes(x = {{ var }})) +
176181
geom_histogram(binwidth = binwidth) +
177182
labs(title = str_englue("A histogram of {{var}} with binwidth {binwidth}"))
178183
}
179184
180-
iris |> histogram_plot(Sepal.Length, binwidth = 0.1)
185+
iris %>%
186+
histogram_plot(Sepal.Length, binwidth = 0.1)
181187
```
182188

183189

@@ -186,12 +192,12 @@ iris |> histogram_plot(Sepal.Length, binwidth = 0.1)
186192
Extra spaces are accidentally entered when working with survey data, and problems can arise when evaluating such data because of extra spaces. Therefore, the function `str_rm_whitespace_df()` eliminates your data frame unnecessary leading, trailing, or other whitespaces.
187193

188194
```{r example 6a}
189-
# A dataframe with whitespaces
195+
# a dataframe with whitespaces
190196
191197
richest_in_nigeria
192198
```
193199
```{r example6b}
194-
# A dataframe with no whitespaces
200+
# a dataframe with no whitespaces
195201
196202
str_rm_whitespace_df(richest_in_nigeria)
197203
```

README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,14 @@ library(forstringr)
7777

7878
ethnicity <- c("Hausa", NA, "Yoruba", "Ijaw", "Igbo", NA, "Ibibio", "Tiv", "Fulani", "Kanuri", "Others")
7979

80-
length(ethnicity) # Count all the observations, including the NAs.
80+
# count all the observations, including NAs.
81+
82+
length(ethnicity)
8183
#> [1] 11
8284

85+
86+
# count all the observations, without NAs.
87+
8388
length_omit_na(ethnicity)
8489
#> [1] 9
8590
```
@@ -202,13 +207,14 @@ transforms it to a string using the default name operation.
202207
library(ggplot2)
203208

204209
histogram_plot <- function(df, var, binwidth) {
205-
df |>
210+
df %>%
206211
ggplot(aes(x = {{ var }})) +
207212
geom_histogram(binwidth = binwidth) +
208213
labs(title = str_englue("A histogram of {{var}} with binwidth {binwidth}"))
209214
}
210215

211-
iris |> histogram_plot(Sepal.Length, binwidth = 0.1)
216+
iris %>%
217+
histogram_plot(Sepal.Length, binwidth = 0.1)
212218
```
213219

214220
<img src="man/figures/README-example_6-1.png" width="100%" />
@@ -221,7 +227,7 @@ Therefore, the function `str_rm_whitespace_df()` eliminates your data
221227
frame unnecessary leading, trailing, or other whitespaces.
222228

223229
``` r
224-
# A dataframe with whitespaces
230+
# a dataframe with whitespaces
225231

226232
richest_in_nigeria
227233
#> # A tibble: 10 × 5
@@ -240,7 +246,7 @@ richest_in_nigeria
240246
```
241247

242248
``` r
243-
# A dataframe with no whitespaces
249+
# a dataframe with no whitespaces
244250

245251
str_rm_whitespace_df(richest_in_nigeria)
246252
#> # A tibble: 10 × 5

man/str_title_case.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test-str_split_extract.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ test_that("str_split_extract() split up a string into pieces and extract the res
44
c("Ibadan", "Ikeja", "Ilorin")
55
)
66
})
7+

0 commit comments

Comments
 (0)