Changelog
Source:NEWS.md
dafJuliaWrapper 0.1.0
First CRAN release. Renamed from dafr — the dafr name has been freed for a native-R reimplementation in a separate repository. This package is the JuliaCall-based wrapper around DataAxesFormats.jl and has been renamed accordingly.
Migration from dafr
-
library(dafr)becomeslibrary(dafJuliaWrapper). -
options(dafr.JULIA_HOME = ...)becomesoptions(dafJuliaWrapper.JULIA_HOME = ...); same fordafr.julia_environmentand otherdafr.*options. - Public API (function names, arguments, return shapes) is unchanged.
New Features
AnnData-like facade
-
as_anndata(daf)returns aDafAnnDataR6 object exposing$X,$obs,$var,$layers,$uns,$obs_names,$var_names,$n_obs,$n_vars, and$shape. Read-only and live: accesses go through to the underlying Daf on demand, served by the R-side cache on hits.obs_axis/var_axisauto-detectcell/metacellandgene;x_nameis validated at construction.
R-side caching
-
get_vector,get_matrix, andaxis_vectornow cache results on the R side, keyed by Daf-level version counters so that modifications viaset_vector/set_matrix/add_axisinvalidate entries automatically. - The cache env is stored directly on each
Dafobject, so there is no global registry and no leak. Two R-level copies of the sameDaflist share the cache (reference semantics); two wrappers of the same Julia object get separate caches. -
empty_cache(daf, clear = ..., keep = ...)now always purges the R-side cache (regardless of selectors) and validates its arguments withmatch.arg.
Performance
- Consolidated
from_julia_arrayfrom 9 sequential Julia↔︎R bridge calls to 4 (5–6 for named arrays). The helper is re-entrant and uses structured Tuple return (no Main-level globals, no string delimiters). -
_prepare_for_reagerly materialises dense non-zero-copy types (Bool,String, etc.) in Julia, saving acollect()round-trip on the R side. - Version counters are now fetched as strings, preventing
UInt32overflow when converting to R integers.axis_version_counter,vector_version_counter, andmatrix_version_counterreturn character strings; compare withidentical()or==. -
_prepare_for_rflattens type dispatch to reduce cold-start JIT cost.
CRAN compliance
- DESCRIPTION: updated
Title,Description,URL,BugReports. -
cran-comments.mddocuments Julia dependency handling,\dontrun{}examples, vignette eval-off, and theJULIA_AVAILABLEtest guard. - Vignette chunks are explicitly
eval = FALSE, purl = FALSEso R CMD check’s tangle step does not try to initialise Julia. -
inst/WORDLISTupdated for spelling checks. - All Julia-dependent tests guarded with
skip_if(!JULIA_AVAILABLE).
Safety
-
jl_R_to_julia_type(internal) now validates string inputs against a whitelist regex and rejects anything that isn’t a plausible Julia type name. Prevents arbitrary Julia code execution via the type-conversion path. -
Daf(jl_obj)rejects non-JuliaObject inputs with a clear error instead of passing them through silently.
Breaking changes vs. dafr
- Package name. All the options and
library()calls above. -
get_vector/get_matrixreturn values for zero-copy types are now live views over Julia memory (viajlview/jlview_sparse). Copy explicitly (as.numeric(v),as.matrix(m)) if stability across subsequent Daf modifications is needed.