pointblank

rstudio活跃维护

R 语言的数据质量校验工具,用简洁的断言语法检查数据框和数据库表,自动生成元数据报告,帮你在分析前发现脏数据。

Data quality assessment and metadata reporting for data frames and database tables

v0.12.4发布于 2026-07-21 04:11 UTC1,054star63fork同步于 2026-11-07 07:31 UTC

怎么上手

由 README 提炼,执行前请确认
install.packages("pointblank")
硬件要求按 README 说明

README 未说明;这是 R 包,无 GPU 或显存要求,本地数据框与数据库表均可校验

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

R 包 pointblank:对数据框和数据库表做系统化数据质量校验与元数据报告

R 语言的数据质量校验工具,用简洁的断言语法检查数据框和数据库表,自动生成元数据报告,帮你在分析前发现脏数据。

核心能力

  • 用 agent 对象串联大量校验函数并 interrogate 出报告
  • 支持自定义表达式、数据分段和目标表选择性变换
  • 校验可直接作用于数据管道,超阈值即告警或报错
  • 用 informant 维护表元数据并生成数据字典
  • 远程表校验全部在库内执行,无需拉取数据

容易踩的坑

校验数据库或 Spark 表需传入 tbl_dbi 或 tbl_spark 对象,Spark 需通过 sparklyr 连接;管道校验工作流默认任一失败单元即报错,需按需调整阈值;README 未给出默认端口等信息

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本v0.12.4
  1. v0.12.4最新正式版2026-07-21 · 2026-07-21 04:11 UTC

    This release provides several bug fixes.

    • Deprecated log4r_step() and logging support in validate_rmd() following the removal of {log4r} from CRAN (#672).

    • Fixed rendering of ampersands in specially() assertions within the agent report (#661). (#673)

    • Fixed get_sundered_data() failing on DB tables when using type = "combined" (#637). (#649, @pachadotdev)

    • Fixed export_report() not working for multiagent objects (#449). (#647, @pachadotdev)

    • Fixed scan_data() error caused by incorrect access to dplyr/ggplot2 namespace (#628). (#646, @pachadotdev)

    • Fixed plot error when dimensions exceed 50 inches (#365). (#648, @pachadotdev)

    • Fixed DuckDB tables throwing an error when passed to create_agent() due to newline handling in identifier strings (#635). (#639, @petrbouchal)

    • Fixed passing of variable names to the preconditions argument (#315). (#671, @pachadotdev)

    • Avoided use of deprecated dplyr::case_match(). (#669, @olivroy)

  2. v0.12.32025-11-28 · 2025-11-28 19:33 UTC
    查看更新说明
    • We now support validation checks of Oracle tables via ODBC (#462). (#644, @pachadotdev)

    • Redshift table support has now been fixed (#538). (#623, #643, @pachadotdev and @hfrick)

    • Added the na_pass argument to col_vals_expr() for finer control of NA values. Previously, NAs were ignored, but now they are caught as failures with the default na_pass = FALSE. As a safeguard, if an expression generates NA values while na_pass is not explicitly supplied, a warning is thrown (#616). (#617)

    • Added an infix resolution for log4r_step()'s message argument (#654). (#656, @alexpaynter)

    • Fixed the issue where an agent would auto-generating a table label that was too long (truncation occurs now) (#613). (#614)

    • Fixed problem where agents would not search the formula environment when materializing ~ tbl (#598). (#599)

    • info_columns() now warns more informatively when no columns are selected (#344). (#589).

    • write_yaml() errors more informatively now when a tbl value is incompatible for YAML-writing (#596). (#597)

    • The yaml_agent_string() function now returns the yaml string (#609). (#610)

    • The col_vals_regex() function now supports Perl regexes (#606). (#608)

    • We now use a safeguard to fall back to the original string as-is if glue interpolation fails (useful in cases where a user-provided regex like {1,2} is to be preservedin in autobrief but triggers an error by {glue}) (#600). (#601)

    • Data extracts for rows_distinct()/rows_complete() now preserve all columns, not just the ones tested (#475). (#588, #591)

    • The brief argument of validation functions now also supports {glue} syntax. (#587)

    • Validation step briefs correctly recycle to match expanded steps. (#564)

    • Performed extensive refactoring of internal dplyr and ggplot2 code. (#579, #582, #583, @olivroy)

    • Rebuilt translation table and added support for ordered factors in scan_data(). (#580, @olivroy)

    • Modernized test infrastructure and removed deprecated testthat features. (#577, @olivroy)

    • Added a new Get Started vignette. (#605, @hfrick)

    • The README.md has undergone some refinements. (#618)

  3. v0.12.22024-10-23 · 2024-10-23 13:58 UTC
    查看更新说明

    This release provides a few minor improvements along with many bug fixes.

    • New argument extract_tbl_checked added to interrogate(). When FALSE, the $tbl_checked column from the validation set will be dropped before returning the agent. This may be helpful in reducing object size for large agents (#542). (#554)

    • The new argument na_rm in snip_list() suppresses any NA values so that they won't included in the snippet's list of items (#547). (#556)

    • Improved readability of error messages rendered as tooltips in the agent report. (#543)

    • col_vals_expr() shows used columns in the agent report when interrogated. (#570)

    • Improved the matching of rows between agent$validation_step and the rows of the agent report (#563). (#565)

    • Functions accepting ... now use rlang::list2(), enabling dynamic dots. For example, a multiagent can now be constructed from a list() of agents using create_multiagent(!!!list_of_agents) (#552). (#553)

    • Fixed bug with non-standard column names in some validation functions (#545, #546). (#555)

    • Fixed a regression in col_vals_*() functions, where vars("col") was evaluating to the string "col". Behavior of vars("col") is now aligned back with vars(col) - both evaluate to the column name col. (#535)

    • Problems arising from comparing columns to a value of different class (for example, comparing a datetime column to a date value Sys.Date() instead of another datetime value Sys.time()) are now signalled appropriately at interrogate() (#536, #537). (#539)

    • Fixed bug in has_columns() failing to detect non-existing columns when supplied as a character vector. (#540)

    • Replace uses of crayon::make_style() with cli::make_ansi_style(), removing the crayon dependency. (#559, thanks @olivroy!)

    • Use rlang::check_installed() to perform checks of optional package installs. (#559, @olivroy)

    • Modernized CI workflows with dedicated linting action. (#560, @olivroy)

    • Avoid unwanted equation formatting in agent report arising from arbitrary "$" characters (#561). (#562)

  4. v0.12.12024-03-25 · 2024-03-25 19:26 UTC
    查看更新说明
    • Ensured that the column string is a symbol before constructing the expression for the col_vals_*() functions.

    • No longer resolve columns with tidyselect when the target table cannot be materialized.

    • Relaxed tests on tidyselect error messages.

  5. v0.12.02024-03-01 · 2024-03-01 13:26 UTC
    查看更新说明

    New features

    • Complete {tidyselect} support for the columns argument of all validation functions, as well as in has_columns() and info_columns. The columns argument can now take familiar column-selection expressions as one would use inside dplyr::select(). This also begins a process of deprecation:

      • columns = vars(...) will continue to work, but c() now supersedes vars().
      • If passing an external vector of column names, it should be wrapped in all_of().
    • The label argument of validation functions now exposes the following string variables via {glue} syntax:

      • "{.step}": The validation step name
      • "{.col}": The current column name
      • "{.seg_col}": The current segment's column name
      • "{.seg_val}": The current segment's value/group

      These dynamic values may be useful for validations that get expanded into multiple steps.

    • interrogate() gains two new options for printing progress in the console output:

      • progress: Whether interrogation progress should be printed to the console (TRUE for interactive sessions, same as before)
      • show_step_label: Whether each validation step's label value should be printed alongside the progress.

    Minor improvements and bug fixes

    • Fixes issue with rendering reports in Quarto HTML documents.

    • When no columns are returned from a {tidyselect} expression in columns, the agent's report now displays the originally supplied expression instead of simply blank (e.g., in create_agent(small_table) |> col_vals_null(matches("z"))).

    • Fixes issue with the hashing implementation to improve performance and alignment of validation steps in the multiagent.

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    CRAN status License: MIT R-CMD-check Linting Codecov test coverage Best Practices The project has reached a stable, usable state and is being actively developed. Monthly Downloads Total Downloads Posit Cloud Discord Contributor Covenant

    With the pointblank package it’s really easy to methodically validate your data whether in the form of data frames or as database tables. On top of the validation toolset, the package gives you the means to provide and keep up-to-date with the information that defines your tables.

    For table validation, the agent object works with a large collection of simple (yet powerful!) validation functions. We can enable much more sophisticated validation checks by using custom expressions, segmenting the data, and by selective mutations of the target table. The suite of validation functions ensures that everything just works no matter whether your table is a data frame or a database table.

    Sometimes, we want to maintain table information and update it when the table goes through changes. For that, we can use an informant object plus associated functions to help define the metadata entries and present it as a data dictionary. Just like we can with validation, pointblank offers easy ways to have the metadata updated so that this important documentation doesn't become stale.

    TABLE VALIDATIONS WITH AN AGENT AND DATA QUALITY REPORTING

    Data validation can be carried out in Data Quality Reporting workflow, ultimately resulting in the production of a data quality analysis report. This is most useful in a non-interactive mode where data quality for database tables and on-disk data files must be periodically checked. The pointblank agent is given a collection of validation functions to define validation steps. We can get extracts of data rows that failed validation, set up custom functions that are invoked by exceeding set threshold failure rates, etc. Want to email the report regularly (or, only if certain conditions are met)? Yep, you can do all that.

    Here is an example of how to use pointblank to validate a local table with an agent.

    # Generate a simple `action_levels` object to
    # set the `warn` state if a validation step
    # has a single 'fail' test unit
    al <- action_levels(warn_at = 1)
    
    # Create a pointblank `agent` object, with the
    # tibble as the target table. Use three validation
    # functions, then, `interrogate()`. The agent will
    # then have some useful intel.
    agent <- 
      dplyr::tibble(
        a = c(5, 7, 6, 5, NA, 7),
        b = c(6, 1, 0, 6,  0, 7)
      ) %>%
      create_agent(
        label = "A very *simple* example.",
        actions = al
      ) %>%
      col_vals_between(
        columns = a,
        left = 1,
        right = 9,
        na_pass = TRUE
      ) %>%
      col_vals_lt(
        columns = c, 12,
        preconditions = ~ . %>% dplyr::mutate(c = a + b)
      ) %>%
      col_is_numeric(columns = c(a, b)) %>%
      interrogate()
    

    The reporting’s pretty sweet. We can get a gt-based report by printing an agent.

    The pointblank package is designed to be both straightforward yet powerful. And fast! Local data frames don’t take very long to validate extensively and all validation checks on remote tables are done entirely in-database. So we can add dozens or even hundreds of validation steps without any long waits for reporting.

    Should you want to perform validation checks on database or Spark tables, provide a tbl_dbi or tbl_spark object to create_agent(). The pointblank package currently supports PostgreSQL. MySQL, MariaDB, Microsoft SQL Server, Google BigQuery, DuckDB, SQLite, and Spark DataFrames (through the sparklyr package).

    Here are some validation reports for the considerably larger intendo::intendo_revenue table.

           

    VALIDATIONS DIRECTLY ON DATA

    The Pipeline Data Validation workflow uses the same collection of validation functions but without need of an agent. This is useful for an ETL process where we want to periodically check data and trigger warnings, raise errors, or write out logs when exceeding specified failure thresholds. It’s a cinch to perform checks on import of the data and at key points during the transformation process, perhaps stopping data flow if things are unacceptable with regard to data quality.

    The following example uses the same three validation functions as before but, this time, we use them directly on the data. The validation functions act as a filter, passing data through unless execution is stopped by failing validations beyond the set threshold. In this workflow, by default, an error will occur if there is a single ‘fail’ test unit in any validation step:

    dplyr::tibble(
        a = c(5, 7, 6, 5, NA, 7),
        b = c(6, 1, 0, 6,  0, 7)
      ) %>%
      col_vals_between(
        columns = a,
        left = 1,
        right = 9,
        na_pass = TRUE
      ) %>%
      col_vals_lt(
        columns = c,
        value = 12,
        preconditions = ~ . %>% dplyr::mutate(c = a + b)
      ) %>%
      col_is_numeric(columns = c(a, b))
    
    Error: Exceedance of failed test units where values in `c` should have been < `12`.
    The `col_vals_lt()` validation failed beyond the absolute threshold level (1).
    * failure level (2) >= failure threshold (1) 
    

    We can downgrade this error to a warning with the warn_on_fail() helper function (assigning it to actions). In this way, the data will always be returned, but warnings will appear.

    # The `warn_on_fail()` function is a nice
    # shortcut for `action_levels(warn_at = 1)`;
    # it works great in this data checking workflow
    # (and the threshold can still be adjusted)
    dplyr::tibble(
        a = c(5, 7, 6, 5, NA, 7),
        b = c(6, 1, 0, 6,  0, 7)
      ) %>%
      col_vals_between(
        columns = a,
        left = 1,
        right = 9,
        na_pass = TRUE,
        actions = warn_on_fail()
      ) %>%
      col_vals_lt(
        columns = c,
        value = 12,
        preconditions = ~ . %>% dplyr::mutate(c = a + b),
        actions = warn_on_fail()
      ) %>%
      col_is_numeric(
        columns = c(a, b),
        actions = warn_on_fail()
      )
    
    #> # A tibble: 6 x 2
    #>       a     b
    #>   <dbl> <dbl>
    #> 1     5     6
    #> 2     7     1
    #> 3     6     0
    #> 4     5     6
    #> 5    NA     0
    #> 6     7     7
    
    Warning message:
    Exceedance of failed test units where values in `c` should have been < `12`.
    The `col_vals_lt()` validation failed beyond the absolute threshold level (1).
    * failure level (2) >= failure threshold (1) 
    

    Should you need more fine-grained thresholds and resultant actions, the action_levels() function can be used to specify multiple failure thresholds and side effects for each failure state. However, with warn_on_fail() and stop_on_fail() (applied by default, with stop_at = 1), you should have good enough options for this validation workflow.

    TABLE INFORMATION

    Table information can be synthesized in an information management workflow, giving us a snapshot of a data table we care to collect information on. The pointblank informant is fed a series of info_*() functions to define bits of information about a table. This info text can pertain to individual columns, the table as a whole, and whatever additional information makes sense for your organization. We can even glean little snippets of information (like column stats or sample values) from the target table with info_snippet() and the snip_*() functions and mix them into the data dictionary wherever they're needed.

    Here is an example of how to use pointblank to incorporate pieces of info text into an informant object.

    # Create a pointblank `informant` object, with the
    # tibble as the target table. Use a few information
    # functions and end with `incorporate()`. The informant
    # will then show you information about the tibble.
    informant <- 
      dplyr::tibble(
        a = c(5, 7, 6, 5, NA, 7),
        b = c(6, 1, 0, 6,  0, 7)
      ) %>%
      create_informant(
        label = "A very *simple* example.",
        tbl_name = "example_tbl"
      ) %>%
      info_tabular(
        description = "This two-column table is nothing all that
        interesting, but, it's fine for examples on **GitHub**
        `README` pages. Column names are `a` and `b`. ((Cool stuff))"
      ) %>%
      info_columns(
        columns = a,
        info = "This column has an `NA` value. [[Watch out!]]<<color: red;>>"
      ) %>%
      info_columns(
        columns = a,
        info = "Mean value is `{a_mean}`."
      ) %>%
      info_columns(
        columns = b,
        info = "Like column `a`. The lowest value is `{b_lowest}`."
      ) %>%
      info_columns(
        columns = b,
        info = "The highest value is `{b_highest}`."
      ) %>%
      info_snippet(
        snippet_name = "a_mean",
        fn = ~ . %>% .$a %>% mean(na.rm = TRUE) %>% round(2)
      ) %>%
      info_snippet(snippet_name = "b_lowest", fn = snip_lowest("b")) %>%
      info_snippet(snippet_name = "b_highest", fn = snip_highest("b")) %>%
      info_section(
        section_name = "further information", 
        `examples and documentation` = "Examples for how to use the
        `info_*()` functions (and many more) are available at the
        [**pointblank** site](https://rstudio.github.io/pointblank/)."
      ) %>%
      incorporate()
    

    By printing the informant we get the table information report.

    Here is a link to a hosted information report for the intendo::intendo_revenue table:

    Information Report for intendo::intendo_revenue

    TABLE SCANS

    We can use the scan_data() function to generate a comprehensive summary of a tabular dataset. This allows us to quickly understand what's in the dataset and it helps us determine if there are any peculiarities within the data. Scanning the dplyr::storms dataset with scan_data(tbl = dplyr::storms) gives us an interactive HTML report. Here are a few of them, published in RPubs:

    Table Scan of dplyr::storms

    Table Scan of pointblank::game_revenue

    Database tables can be used with scan_data() as well. Here are two examples using (1) the full_region table of the Rfam database (hosted publicly at mysql-rfam-public.ebi.ac.uk) and (2) the assembly table of the Ensembl database (hosted publicly at ensembldb.ensembl.org).

    Rfam:
full_region

    Ensembl:
assembly

    OVERVIEW OF PACKAGE FUNCTIONS

    There are many functions available in pointblank for understanding data quality and creating data documentation. Here is an overview of all of them, grouped by family. For much more information on these, visit the documentation website or take a Test Drive in the Posit Cloud project.

    INSTALLATION

    Want to try this out? The pointblank package is available on CRAN:

    install.packages("pointblank")
    

    You can also install the development version of pointblank from GitHub:

    # install.packages("pak")
    pak::pak("rstudio/pointblank")
    

    Getting in Touch

    If you encounter a bug, have usage questions, or want to share ideas to make this package better, feel free to file an issue.

    Wanna talk about data validation in a more relaxed setting? Join our Discord server! This is a great option for asking about the development of pointblank, pitching ideas that may become features, and just sharing your ideas!

    Discord Server

    Pointblank for Python

    There's also a version of pointblank for Python, a project that got off the ground in late 2024 and is gaining traction in the Python community. You can find it at https://github.com/posit-dev/pointblank.


    Code of Conduct

    Please note that the gt project is released with a contributor code of conduct.By participating in this project you agree to abide by its terms.

    📄 License

    pointblank is licensed under the MIT license. See the LICENSE.md file for more details.

    © Posit Software, PBC.

    🏛️ Governance

    This project is primarily maintained by Rich Iannone. Other authors may occasionally assist with some of these duties.