collapse version 2.0.14
-
Updated 'collapse and sf' vignette to reflect the recent support for units objects, and added a few more examples.
-
Fixed a bug in
join()
where a full join silently became a left join if there are no matches between the tables (#574). Thanks @D3SL for reporting. -
Added function
group_by_vars()
: A standard evaluation version offgroup_by()
that is slimmer and safer for programming, e.g.data |> group_by_vars(ind1) |> collapg(custom = list(fmean = ind2, fsum = ind3))
. Or, using magrittr:
library(magrittr)
set_collapse(mask = "manip") # for fgroup_vars -> group_vars
data %>%
group_by_vars(ind1) %>% {
add_vars(
group_vars(., "unique"),
get_vars(., ind2) %>% fmean(keep.g = FALSE) %>% add_stub("mean_"),
get_vars(., ind3) %>% fsum(keep.g = FALSE) %>% add_stub("sum_")
)
}
-
Added function
as_integer_factor()
to turn factors/factor columns into integer vectors.as_numeric_factor()
already exists, but is memory inefficient for most factors where levels can be integers. -
join()
now internally checks if the rows of the joined datasets match exactly. This check, usingidentical(m, seq_row(y))
, is inexpensive, but, ifTRUE
, saves a full subset and deep copy ofy
. Thusjoin()
now inherits the intelligence already present in functions likefsubset()
,roworder()
andfunique()
- a key for efficient data manipulation is simply doing less. -
In
join()
, ifattr = TRUE
, thecount
option tofmatch()
is always invoked, so that the attribute attached always has the same form, regardless ofverbose
orvalidate
settings. -
roworder[v]()
has optional settingverbose = 2L
to indicate ifx
is already sorted, making the call toroworder[v]()
redundant.