Skip to content

Review/Document how pointblank handles date variables #659

@hfrick

Description

@hfrick

I stubbed my toes on how pointblank handles POSIXct columns (#640). That behavior also surprised Katie (https://github.com/rstudio/pointblank/pull/642/files/6b0bd4a66c50c8d306d50a78a7394cc6ad740196#r2301782280).

I'm opening this issue as a place to collect examples where there was a mismatch between expectation and actual behavior so that we can review if we want to change anything or instead document that in a separate little how-to article to increase visibility?

The reprex is a mash-up of my own and Katie's surprise wrt POSIXct.

library(pointblank)

# define a date column as POSIXct
sales <- dplyr::tibble(
  amount = c(100, 200, 300),
  customer_name = c("Alice", "Bianca", "Charlie"),
  sale_date = as.POSIXct(c("2023-01-01", "2023-01-02", "2023-01-03"))
)

# define schema with POSIXct
schema <- col_schema(
  amount = "numeric",
  customer_name = "character",
  sale_date = "POSIXct"
)

agent <- create_agent(sales, actions = action_levels(stop_at = 1)) |> 
  col_schema_match(schema) |> 
  interrogate(progress = TRUE)
#> 
#> ── Interrogation Started - there is a single validation step ───────────────────
#> ✖ Step 1: STOP condition met.
#> 
#> ── Interrogation Completed ─────────────────────────────────────────────────────
xlist <- get_agent_x_list(agent)

# the validation step fails
xlist$n
#> [1] 1
xlist$n_failed
#> [1] 1

# because the `sale_date` column has two classes while the schema only specifies one
class(sales$sale_date)
#> [1] "POSIXct" "POSIXt"

# however, the x_list also only lists one class for `sale_date`
xlist$col_types[xlist$col_names == "sale_date"]
#> [1] "POSIXct"

Created on 2025-10-15 with reprex v2.1.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions