Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@

* `unite()` now removes old columns before adding new (#89, @krlmlr).

* `separate()` now warns if defunct ... argument is used (#151, @krlmlr).

# tidyr 0.3.1

* Fixed bug where attributes of non-gather columns were lost (#104)
Expand Down
13 changes: 8 additions & 5 deletions R/separate.R
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ separate <- function(data, col, into, sep = "[^[:alnum:]]+", remove = TRUE,
#' @param convert If \code{TRUE}, will run \code{\link{type.convert}} with
#' \code{as.is = TRUE} on new columns. This is useful if the component
#' columns are integer, numeric or logical.
#' @param ... Other arguments passed on to \code{\link{strsplit}} to control
#' how the regular expression is processed.
#' @param ... Defunct, will be removed in the next version of the package.
#' @keywords internal
#' @export
separate_ <- function(data, col, into, sep = "[^[:alnum:]]+", remove = TRUE,
Expand All @@ -87,6 +86,10 @@ separate_.data.frame <- function(data, col, into, sep = "[^[:alnum:]]+",
stopifnot(is.character(col), length(col) == 1)
value <- as.character(data[[col]])

if (length(list(...)) != 0) {
warning("Using ... for passing arguments to strsplit is defunct.")
}

if (is.numeric(sep)) {
l <- strsep(value, sep)
} else if (is.character(sep)) {
Expand Down Expand Up @@ -116,9 +119,9 @@ separate_.tbl_df <- function(data, col, into, sep = "[^[:alnum:]]+",
}

#' @export
separate_.tbl_df <- function(data, col, into, sep = "[^[:alnum:]]+",
remove = TRUE, convert = FALSE,
extra = "warn", fill = "warn", ...) {
separate_.grouped_df <- function(data, col, into, sep = "[^[:alnum:]]+",
remove = TRUE, convert = FALSE,
extra = "warn", fill = "warn", ...) {
dplyr::grouped_df(NextMethod(), dplyr::groups(data))
}

Expand Down
4 changes: 2 additions & 2 deletions R/spread.R
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ spread_.tbl_df <- function(data, key_col, value_col, fill = NA,
}

#' @export
spread_.tbl_df <- function(data, key_col, value_col, fill = NA,
convert = FALSE, drop = TRUE) {
spread_.grouped_df <- function(data, key_col, value_col, fill = NA,
convert = FALSE, drop = TRUE) {
regroup(data, NextMethod(), except = c(key_col, value_col))
}

Expand Down
3 changes: 1 addition & 2 deletions man/separate.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions man/separate_.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.