--- title: "Translations" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{translations} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r, include = FALSE} knitr::opts_chunk$set( collapse = TRUE, eval = identical(Sys.getenv("IN_PKGDOWN"), "true") || (getRversion() >= "4.1"), comment = "#>" ) Sys.setenv(DUCKPLYR_FALLBACK_COLLECT = 0) ``` ## Data types duckplyr supports the following data types: - `is.logical()` - `is.integer()` - `is.numeric()` - `is.character()` - `is.Date()` - `is.POSIXct()` (with UTC time zone) - `is.difftime()` ```{r} duckplyr::duckdb_tibble( logical = TRUE, integer = 1L, numeric = 1.1, character = "a", Date = as.Date("2025-01-11"), POSIXct = as.POSIXct("2025-01-11 19:23:00", tz = "UTC"), difftime = as.difftime(1, units = "secs"), ) |> dplyr::compute() ``` Support for more data types, and passthrough of unknown data types, is planned. Let's [discuss](https://github.com/tidyverse/duckplyr/discussions/) any additional data types you would like to see supported. ## Verbs Not all dplyr verbs are implemented within duckplyr. For unsupported verbs, duckplyr automatically falls back to dplyr. See `?unsupported` for a list of verbs for which duckplyr does not provide a method. See the [reference index](https://duckplyr.tidyverse.org/reference/index.html) for a list of verbs with corresponding duckplyr methods. Let's [discuss](https://github.com/tidyverse/duckplyr/discussions/) any additional verbs you would like to see supported. ## Functions within verbs For all functions used in dplyr verbs, translations must be provided. As of now, here are the translations provided: - Parentheses: `(` (`?Paren`) - Comparison operators: `==`, `>`, `!=`, `<`, `>=`, `<=` (`?Comparison`) - Basic arithmetics: `+`, `/`, `-`, `*` (`?Arithmetic`) - Math functions: `log10()`, `log()`, `abs()` - Logical operators: `!`, `&`, `|` (`?Logic`) - Branching and conversion: `is.na()`, `dplyr::if_else()`, `as.integer()`, `strftime()` - String manipulation: `grepl()`, `substr()`, `sub()`, `gsub()` - Date manipulation: `lubridate::hour()`, `lubridate::minute()`, `lubridate::second()`, `lubridate::wday()` - Aggregation - `sum()`, `dplyr::n()`, `dplyr::n_distinct()` - `mean()`, `median()`, `sd()` - `min()`, `max()` - `any()` - `dplyr::first()`, `dplyr::last()`, `dplyr::nth()` - Ranking - `dplyr::row_number()` - `rank()`, `dplyr::min_rank()`, `dplyr::dense_rank()` - `dplyr::percent_rank()`, `dplyr::cume_dist()` - `dplyr::ntile()` - Shifting: `dplyr::lag()`, `dplyr::lead()` - Special cases - `$` (`?Extract`) is implemented if the LHS is `.data` or `.env` - `%in%` (`?match`) is implemented if the RHS is a constant with up to 100 values - `dplyr::desc()` is only implemented in the context of `dplyr::arrange()` - `suppressWarnings()` is a no-op Refer to [our contributing guide](https://duckplyr.tidyverse.org/CONTRIBUTING.html#new-translations-for-functions) to learn how to contribute new translations.