Skip to content

Name matchData()'s arguments for what they are - #23

Merged
chross22 merged 1 commit into
masterfrom
generalize-matchdata
Aug 7, 2026
Merged

Name matchData()'s arguments for what they are#23
chross22 merged 1 commit into
masterfrom
generalize-matchdata

Conversation

@chross22

@chross22 chross22 commented Aug 7, 2026

Copy link
Copy Markdown
Owner

matchData() joins two sf point objects by space and time. It was never specific to species observations or environmental data — but speciesDat and envDat described one use of it as though it were the only one, and the docs followed the names, so the general case was invisible.

matchData(dat, source)

dat is the side that gets columns added; source is the side they come from. Tag positions against a model field, moorings against satellite retrievals, one gridded product against another — all the same operation, and now obviously so. There's a test that matches two grids to each other with nothing species-shaped involved.

The old names still work

They warn, but they work:

matchData(observations, env)                 # positional, unchanged
matchData(dat = observations, source = env)  # new
matchData(speciesDat = obs, envDat = env)    # still works, warns

taupatch calls them by name at R/covariates.R:271, and any script written against the old signature does too. Breaking those silently would be worse than carrying a shim. Verified against taupatch's exact call form after rebuilding:

warn: `speciesDat` is now `dat`...
warn: `envDat` is now `source`...
taupatch call works, SST: 2 9

One related change

The collision suffix moves from .env to .matched, for the same reason. Nothing depended on the old one — checked across this package, taupatch, and derivoce.

Thoroughness

The rename goes all the way down, not just the signature:

  • detect_temporal_resolution() takes x rather than envDat
  • standardize_time_columns() takes dat, and its errors say `dat` rather than "speciesDat"
  • the CRS errors name `dat` / `source`
  • every call site in the roxygen and README shows the new names
  • the README section is retitled from "Matching to observations" to "Matching", and leads with the general case
  • test fixtures renamed from make_species_dat/make_env_dat to make_observations/make_env

Four new tests: the deprecation shim (both names, and that old and new produce identical results), positional and named forms, the .matched suffix leaving the caller's column untouched, and a grid-to-grid match.

Verification

R CMD checkStatus: OK. Full suite green. Installed into both R 4.6.1 and 4.3.2. All README anchors re-checked.

🤖 Generated with Claude Code

The function joins two sf point objects by space and time. It was never
specific to species observations or environmental data, but `speciesDat`
and `envDat` described one use of it as though it were the only one -
and the docs followed the names, so the general case was invisible.

`dat` is the side that gets columns added; `source` is the side they
come from. Tag positions against a model field, moorings against
satellite retrievals, one gridded product against another: all the same
operation, and now all obviously so. A test matches two grids to each
other with nothing species-shaped involved.

The old names still work and warn. taupatch calls them by name at
R/covariates.R:271, and any script written against the old signature
does too; breaking those silently is worse than carrying a shim. Checked
against taupatch's exact call form after rebuilding.

The collision suffix moves from ".env" to ".matched" for the same
reason. Nothing depended on the old one - checked across this package,
taupatch, and derivoce.

Internals follow: detect_temporal_resolution() takes `x` rather than
`envDat`, standardize_time_columns() takes `dat`, and their errors name
`dat` rather than a species dataset. Every call site in the roxygen and
the README now shows the new names.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@chross22
chross22 merged commit 72b86ae into master Aug 7, 2026
5 checks passed
@chross22
chross22 deleted the generalize-matchdata branch August 7, 2026 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant