diff --git a/DESCRIPTION b/DESCRIPTION index a30cb1ee..08b81411 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -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", @@ -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 diff --git a/NEWS.md b/NEWS.md index 1047e5c9..41bca107 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,6 @@ -# tidypolars (development) +# tidypolars 0.4.0 + +`tidypolars` requires `polars` >= 0.11.0. **Breaking changes** diff --git a/R/bind.R b/R/bind.R index 7a285c6a..dcd0344b 100644 --- a/R/bind.R +++ b/R/bind.R @@ -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 @@ -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) } diff --git a/R/funs-default.R b/R/funs-default.R index d57d9cae..483c48d6 100644 --- a/R/funs-default.R +++ b/R/funs-default.R @@ -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, ...) { diff --git a/R/funs-string.R b/R/funs-string.R index 1f5d009a..bd15bd47 100644 --- a/R/funs-string.R +++ b/R/funs-string.R @@ -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 } @@ -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 } @@ -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)) } @@ -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, ...) { diff --git a/R/polars.R b/R/polars.R index 783d4937..f98f9729 100644 --- a/R/polars.R +++ b/R/polars.R @@ -3,3 +3,5 @@ #' @import tidyr #' @export NULL + +data <- NULL diff --git a/R/sink_csv.R b/R/sink_csv.R index 097ccd1f..2916524a 100644 --- a/R/sink_csv.R +++ b/R/sink_csv.R @@ -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. @@ -61,7 +63,8 @@ sink_csv <- function( .data, path, - has_header = TRUE, + include_bom = FALSE, + include_header = TRUE, separator = ",", line_terminator = "\n", quote = '"', @@ -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, diff --git a/man/sink_csv.Rd b/man/sink_csv.Rd index 7c547c39..2775f3c5 100644 --- a/man/sink_csv.Rd +++ b/man/sink_csv.Rd @@ -7,7 +7,8 @@ sink_csv( .data, path, - has_header = TRUE, + include_bom = FALSE, + include_header = TRUE, separator = ",", line_terminator = "\\n", quote = "\\"", @@ -32,7 +33,10 @@ sink_csv( \item{path}{Output file (must be a \code{.parquet} file).} -\item{has_header}{Whether to include header in the CSV output.} +\item{include_bom}{Whether to include UTF-8 BOM (byte order mark) in the CSV +output.} + +\item{include_header}{Whether to include header in the CSV output.} \item{separator}{Separate CSV fields with this symbol.}