Skip to content

Commit

Permalink
misc: fix changes related to polars 0.11.0, prepare 0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
etiennebacher committed Nov 27, 2023
1 parent eb69c26 commit efc63d6
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 18 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: tidypolars
Type: Package
Title: Get the Power of Polars with the Syntax of the Tidyverse
Version: 0.3.0.9000
Version: 0.4.0
Authors@R:
person(given = "Etienne",
family = "Bacher",
Expand All @@ -22,7 +22,7 @@ BugReports: https://github.com/etiennebacher/tidypolars/issues
Depends: R (>= 4.1.0)
Imports:
dplyr,
polars (>= 0.10.0),
polars (>= 0.11.0),
rlang,
tidyr,
tidyselect
Expand Down
4 changes: 3 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# tidypolars (development)
# tidypolars 0.4.0

`tidypolars` requires `polars` >= 0.11.0.

**Breaking changes**

Expand Down
4 changes: 2 additions & 2 deletions R/bind.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#' bind_rows_polars(p1, p2, .id = "id")

bind_rows_polars <- function(..., .id = NULL) {
concat_(..., how = "diagonal", .id = .id)
concat_(..., how = "diagonal_relaxed", .id = .id)
}

#' Append multiple Data/LazyFrames next to each other
Expand Down Expand Up @@ -96,7 +96,7 @@ concat_ <- function(..., how, .id = NULL) {
}

if (how == "diagonal") {
pl$concat(dots, how = how, to_supertypes = TRUE)
pl$concat(dots, how = how)
} else {
pl$concat(dots, how = how)
}
Expand Down
8 changes: 4 additions & 4 deletions R/funs-default.R
Original file line number Diff line number Diff line change
Expand Up @@ -194,22 +194,22 @@ pl_cosh <- function(x, ...) {

pl_cumcount <- function(x, ...) {
check_empty_dots(...)
x$cumcount()
x$cum_count()
}

pl_cummin <- function(x, ...) {
check_empty_dots(...)
x$cummin()
x$cum_min()
}

pl_cumprod <- function(x, ...) {
check_empty_dots(...)
x$cumprod()
x$cum_prod()
}

pl_cumsum <- function(x, ...) {
check_empty_dots(...)
x$cumsum()
x$cum_sum()
}

pl_cumulative_eval <- function(x, ...) {
Expand Down
8 changes: 4 additions & 4 deletions R/funs-string.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pl_str_detect <- function(string, pattern, negate = FALSE, ...) {
is_fixed <- isTRUE(attr(pattern, "stringr_attr") == "fixed")
out <- string$str$contains(pattern, literal = is_fixed)
if (isTRUE(negate)) {
out$is_not()
out$not()
} else {
out
}
Expand All @@ -27,7 +27,7 @@ pl_str_ends <- function(string, pattern, negate = FALSE, ...) {
check_empty_dots(...)
out <- string$str$ends_with(pattern)
if (isTRUE(negate)) {
out$is_not()
out$not()
} else {
out
}
Expand Down Expand Up @@ -92,7 +92,7 @@ pl_str_slice <- function(string, start, end = NULL, ...) {
pl_str_starts <- function(string, pattern, negate = FALSE, ...) {
check_empty_dots(...)
if (isTRUE(negate)) {
string$str$starts_with(pl$lit(pattern))$is_not()
string$str$starts_with(pl$lit(pattern))$not()
} else {
string$str$starts_with(pl$lit(pattern))
}
Expand Down Expand Up @@ -194,7 +194,7 @@ pl_str_pad <- function(string, width, side = "left", pad = " ", use_width = TRUE

pl_word <- function(string, start = 1L, end = start, sep = " ", ...) {
check_empty_dots(...)
string$str$split(sep)$list$take((start:end) - 1L)$list$join(sep)
string$str$split(sep)$list$gather((start:end) - 1L)$list$join(sep)
}

pl_str_squish <- function(string, ...) {
Expand Down
2 changes: 2 additions & 0 deletions R/polars.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
#' @import tidyr
#' @export
NULL

data <- NULL
10 changes: 7 additions & 3 deletions R/sink_csv.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
#' crashes because of too small memory.
#'
#' @param .data A Polars LazyFrame.
#' @param has_header Whether to include header in the CSV output.
#' @param include_bom Whether to include UTF-8 BOM (byte order mark) in the CSV
#' output.
#' @param include_header Whether to include header in the CSV output.
#' @param separator Separate CSV fields with this symbol.
#' @param line_terminator String used to end each row.
#' @param quote Byte to use as quoting character.
Expand Down Expand Up @@ -61,7 +63,8 @@
sink_csv <- function(
.data,
path,
has_header = TRUE,
include_bom = FALSE,
include_header = TRUE,
separator = ",",
line_terminator = "\n",
quote = '"',
Expand All @@ -87,7 +90,8 @@ sink_csv <- function(

.data$sink_csv(
path = path,
has_header = has_header,
include_bom = include_bom,
include_header = include_header,
separator = separator,
line_terminator = line_terminator,
quote = quote,
Expand Down
8 changes: 6 additions & 2 deletions man/sink_csv.Rd

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

0 comments on commit efc63d6

Please sign in to comment.