Skip to content

Commit 3a688b4

Browse files
Merge branch 'master' into omit-na
2 parents 5008085 + 48d283c commit 3a688b4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+821
-511
lines changed

.Rbuildignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@
1212
^docs$
1313
^README\.Rmd$
1414
^README-.*\.png$
15+
^appveyor\.yml$

.travis.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,12 @@ language: R
44
sudo: false
55
cache: packages
66

7+
r:
8+
- 3.1
9+
- 3.2
10+
- oldrel
11+
- release
12+
- devel
13+
714
after_success:
815
- Rscript -e 'covr::codecov()'

DESCRIPTION

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,33 @@
11
Package: stringr
2-
Version: 1.2.0.9000
32
Title: Simple, Consistent Wrappers for Common String Operations
3+
Version: 1.2.0.9000
4+
Authors@R: c(
5+
person("Hadley", "Wickham", , "[email protected]", c("aut", "cre", "cph")),
6+
person("RStudio", role = c("cph", "fnd"))
7+
)
48
Description: A consistent, simple and easy to use set of wrappers around the
59
fantastic 'stringi' package. All function and argument names (and positions)
610
are consistent, all functions deal with "NA"'s and zero length vectors
711
in the same way, and the output from one function is easy to feed into
812
the input of another.
9-
Authors@R: c(
10-
person("Hadley", "Wickham", , "[email protected]", c("aut", "cre", "cph")),
11-
person("RStudio", role = c("cph", "fnd"))
12-
)
1313
License: GPL-2 | file LICENSE
14-
Depends:
15-
R (>= 2.14)
16-
Imports:
17-
stringi (>= 1.1.6),
18-
magrittr
19-
Suggests:
20-
testthat,
21-
knitr,
14+
URL: http://stringr.tidyverse.org,
15+
https://github.com/tidyverse/stringr
16+
BugReports: https://github.com/tidyverse/stringr/issues
17+
Depends:
18+
R (>= 3.1)
19+
Imports:
20+
glue,
21+
magrittr,
22+
stringi (>= 1.1.6)
23+
Suggests:
24+
covr,
2225
htmltools,
2326
htmlwidgets,
27+
knitr,
2428
rmarkdown,
25-
covr
29+
testthat
2630
VignetteBuilder: knitr
27-
URL: http://stringr.tidyverse.org,
28-
https://github.com/tidyverse/stringr
29-
BugReports: https://github.com/tidyverse/stringr/issues
30-
RoxygenNote: 6.0.1
3131
LazyData: true
32+
Roxygen: list(markdown = TRUE)
33+
RoxygenNote: 6.0.1

NAMESPACE

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ export("str_sub<-")
55
export(boundary)
66
export(coll)
77
export(fixed)
8-
export(ignore.case)
98
export(invert_match)
10-
export(perl)
119
export(regex)
1210
export(str_c)
1311
export(str_conv)
@@ -16,8 +14,10 @@ export(str_detect)
1614
export(str_dup)
1715
export(str_extract)
1816
export(str_extract_all)
17+
export(str_flatten)
18+
export(str_glue)
19+
export(str_glue_data)
1920
export(str_interp)
20-
export(str_join)
2121
export(str_length)
2222
export(str_locate)
2323
export(str_locate_all)

NEWS.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# stringr 1.2.0.9000
22

3+
* New `str_glue()` and `str_glue_data()` provide convenient wrappers around
4+
`glue` and `glue_data()` from the [glue](http://glue.tidyverse.org/) package
5+
(#157).
6+
7+
* Long deprecated `str_join()`, `ignore.case()` and `perl()` have now been
8+
removed.
9+
10+
* New `str_flatten()` is a wrapper around `stri_flatten()` and clearly
11+
conveys flattening a character vector into a single string (#186).
12+
13+
* `str_trunc()` now preserves NAs (@ClaytonJY, #162)
14+
315
# stringr 1.2.0
416

517
## API changes

R/c.r

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#' Join multiple strings into a single string.
22
#'
3-
#' To understand how \code{str_c} works, you need to imagine that you are
3+
#' To understand how `str_c` works, you need to imagine that you are
44
#' building up a matrix of strings. Each input argument forms a column, and
55
#' is expanded to the length of the longest argument, using the usual
6-
#' recyling rules. The \code{sep} string is inserted between each column. If
7-
#' collapse is \code{NULL} each row is collapsed into a single string. If
8-
#' non-\code{NULL} that string is inserted at the end of each row, and
6+
#' recyling rules. The `sep` string is inserted between each column. If
7+
#' collapse is `NULL` each row is collapsed into a single string. If
8+
#' non-`NULL` that string is inserted at the end of each row, and
99
#' the entire matrix collapsed to a single string.
1010
#'
1111
#' @param ... One or more character vectors. Zero length arguments
@@ -14,16 +14,16 @@
1414
#'
1515
#' Like most other R functions, missing values are "infectious": whenever
1616
#' a missing value is combined with another string the result will always
17-
#' be missing. Use \code{\link{str_replace_na}} to convert \code{NA} to
18-
#' \code{"NA"}
17+
#' be missing. Use [str_replace_na()] to convert `NA` to
18+
#' `"NA"`
1919
#' @param sep String to insert between input vectors.
2020
#' @param collapse Optional string used to combine input vectors into single
2121
#' string.
22-
#' @return If \code{collapse = NULL} (the default) a character vector with
23-
#' length equal to the longest input string. If \code{collapse} is
22+
#' @return If `collapse = NULL` (the default) a character vector with
23+
#' length equal to the longest input string. If `collapse` is
2424
#' non-NULL, a character vector of length 1.
25-
#' @seealso \code{\link{paste}} for equivalent base R functionality, and
26-
#' \code{\link[stringi]{stri_join}} which this function wraps
25+
#' @seealso [paste()] for equivalent base R functionality, and
26+
#' [stringi::stri_join()] which this function wraps
2727
#' @export str_c
2828
#' @examples
2929
#' str_c("Letter: ", letters)
@@ -42,11 +42,3 @@
4242
str_c <- function(..., sep = "", collapse = NULL) {
4343
stri_c(..., sep = sep, collapse = collapse, ignore_null = TRUE)
4444
}
45-
46-
#' @export
47-
#' @rdname str_c
48-
#' @usage NULL
49-
str_join <- function(..., sep = "", collapse = NULL) {
50-
.Deprecated("str_c")
51-
stri_c(..., sep = sep, collapse = collapse, ignore_null = TRUE)
52-
}

R/conv.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#' This is a convenient way to override the current encoding of a string.
44
#'
55
#' @param string String to re-encode.
6-
#' @param encoding Name of encoding. See \code{\link[stringi]{stri_enc_list}}
6+
#' @param encoding Name of encoding. See [stringi::stri_enc_list()]
77
#' for a complete list.
88
#' @export
99
#' @examples

R/count.r

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#' Count the number of matches in a string.
22
#'
3-
#' Vectorised over \code{string} and \code{pattern}.
3+
#' Vectorised over `string` and `pattern`.
44
#'
55
#' @inheritParams str_detect
66
#' @return An integer vector.
77
#' @seealso
8-
#' \code{\link[stringi]{stri_count}} which this function wraps.
8+
#' [stringi::stri_count()] which this function wraps.
99
#'
10-
#' \code{\link{str_locate}}/\code{\link{str_locate_all}} to locate position
10+
#' [str_locate()]/[str_locate_all()] to locate position
1111
#' of matches
1212
#'
1313
#' @export

R/data.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#' Sample character vectors for practicing string manipulations.
22
#'
3-
#' \code{fruit} and \code{word} come from the \code{rcorpora} package
3+
#' `fruit` and `word` come from the `rcorpora` package
44
#' written by Gabor Csardi; the data was collected by Darius Kazemi
55
#' and made available at \url{https://github.com/dariusk/corpora}.
6-
#' \code{sentences} is a collection of "Harvard sentences" used for
6+
#' `sentences` is a collection of "Harvard sentences" used for
77
#' standardised testing of voice.
88
#'
99
#' @format A character vector.

R/detect.r

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
#' Detect the presence or absence of a pattern in a string.
22
#'
3-
#' Vectorised over \code{string} and \code{pattern}.
3+
#' Vectorised over `string` and `pattern`.
44
#'
55
#' @param string Input vector. Either a character vector, or something
66
#' coercible to one.
77
#' @param pattern Pattern to look for.
88
#'
99
#' The default interpretation is a regular expression, as described
10-
#' in \link[stringi]{stringi-search-regex}. Control options with
11-
#' \code{\link{regex}()}.
10+
#' in [stringi::stringi-search-regex]. Control options with
11+
#' [regex()].
1212
#'
1313
#' Match a fixed string (i.e. by comparing only bytes), using
14-
#' \code{\link{fixed}(x)}. This is fast, but approximate. Generally,
15-
#' for matching human text, you'll want \code{\link{coll}(x)} which
14+
#' [fixed()]. This is fast, but approximate. Generally,
15+
#' for matching human text, you'll want [coll()] which
1616
#' respects character matching rules for the specified locale.
1717
#'
1818
#' Match character, word, line and sentence boundaries with
19-
#' \code{\link{boundary}()}. An empty pattern, "", is equivalent to
20-
#' \code{boundary("character")}.
19+
#' [boundary()]. An empty pattern, "", is equivalent to
20+
#' `boundary("character")`.
2121
#' @return A logical vector.
22-
#' @seealso \code{\link[stringi]{stri_detect}} which this function wraps,
23-
#' \code{\link{str_subset}} for a convenient wrapper around
24-
#' \code{x[str_detect(x, pattern)]}
22+
#' @seealso [stringi::stri_detect()] which this function wraps,
23+
#' [str_subset()] for a convenient wrapper around
24+
#' `x[str_detect(x, pattern)]`
2525
#' @export
2626
#' @examples
2727
#' fruit <- c("apple", "banana", "pear", "pinapple")
@@ -42,4 +42,3 @@ str_detect <- function(string, pattern) {
4242
regex = stri_detect_regex(string, pattern, opts_regex = opts(pattern))
4343
)
4444
}
45-

0 commit comments

Comments
 (0)