dplyr

repository·main·Indexed 26 days ago

https://github.com/tidyverse/dplyr

A grammar of data manipulation for R providing a consistent set of verbs—such as mutate(), select(), filter(), summarise(), arrange(), and group_by()—to solve common data transformation challenges. It works with standard data frames and integrates with high-performance backends including Arrow, DuckDB (via duckplyr), Spark (via sparklyr), and relational databases (via dbplyr).

Tokens
3.9K
Snippets
9
Records
42
Agent score
90%

What's inside dplyr

  1. Overview of dplyr verbs

    main

    dplyr provides a grammar of data manipulation using a consistent set of verbs:

    • mutate(): Adds new variables as functions of existing variables.
    • select(): Picks variables based on their names.
    • filter(): Picks cases (rows) based on their values.
    • summarise(): Reduces multiple values down to a single summary.
    • arrange(): Changes the ordering of the rows.
    • group_by(): Allows any of the above operations to be performed "by group".
  2. Install dplyr

    main

    You can install dplyr either as part of the full tidyverse collection or as a standalone package. To install the development version from GitHub, use the pak package.

    # The easiest way to get dplyr is to install the whole tidyverse:
    install.packages("tidyverse")
    
    # Alternatively, install just dplyr:
    install.packages("dplyr")
  3. Get detailed reverse dependency failure info with revdepcheck

    main

    To retrieve more detailed information regarding reverse dependency failures for a specific package, use the revdepcheck::cloud_details() function.

    Example:

    revdepcheck::cloud_details(, "FairMclus")
  4. Troubleshoot 'arrow' test failures (group_by argument)

    main

    The arrow package may fail tests due to the group_by() function. The add argument in group_by() was deprecated in dplyr 1.0.0 and is now defunct. To resolve this, replace the add argument with the .add argument.

    Error: The `add` argument of `group_by()` was deprecated in dplyr 1.0.0 and is now defunct.
    i Please use the `.add` argument instead.
  5. Replace defunct `dplyr::tbl_df()` with `tibble::as_tibble()`

    main

    The function dplyr::tbl_df() was deprecated in dplyr 1.0.0 and is now defunct. To resolve errors in code or examples, replace all calls to tbl_df() with tibble::as_tibble().

    Example of the error:

    # This will fail in newer dplyr versions
    tbl <- tbl_df(df)

    Correct usage:

    # Use this instead
    tbl <- tibble::as_tibble(df)
  6. Fix defunct `group_by(add = )` usage in dbplot

    main

    The package dbplot (v0.3.3) fails examples and tests because the add argument in group_by() was deprecated in dplyr 1.0.0 and is now defunct. To resolve this, replace add = with the .add argument.

    Error: ! The `add` argument of `group_by()` was deprecated in dplyr 1.0.0 and is now defunct. ℹ Please use the `.add` argument instead.
  7. Debug FairMclus installation error: object 'id' not exported by 'namespace:dplyr'

    main

    The package FairMclus (version 2.2.1) fails during lazy loading in the Devel environment because it attempts to access an object id that is not exported by the dplyr namespace.

    Error Signature:

    Error: object ‘id’ is not exported by 'namespace:dplyr'
    Execution halted
    ERROR: lazy loading failed for package ‘FairMclus’
  8. Replace defunct `tbl_df()` with `tibble::as_tibble()`

    main
    The tbl_df() function was deprecated in dplyr 1.0.0 and is now defunct. If you encounter errors stating `tbl_df()` was deprecated in dplyr 1.0.0 and is now defunct, you must update your code to use tibble::as_tibble() instead.
  9. Resolve 'object is not exported by namespace:dplyr' installation errors

    main

    When installing a package from a development version (Devel), you may encounter an error stating that an object is not exported by namespace:dplyr. This typically occurs during the lazy loading phase of installation.

    Example error: Error: object ‘location’ is not exported by 'namespace:dplyr'

    This indicates the package is attempting to access a dplyr function or object that is no longer part of the public API. You must update the package code to use an exported dplyr symbol or an alternative function.