ecotyper.rcompat.frame¶
data.frame semantics needed to reproduce EcoTyper’s tables row for row.
Functions
|
|
|
|
|
|
|
|
|
|
|
|
- ecotyper.rcompat.frame.r_order(*keys, decreasing=False)[source]¶
order(k1, k2, ...)→ 0-based stable permutation.Numeric keys may be negated by the caller (
order(x, -y)).
- ecotyper.rcompat.frame.factor_levels(values)[source]¶
levels(factor(values)): sorted unique non-NA values.- Return type:
- ecotyper.rcompat.frame.r_match(x, table)[source]¶
match(x, table)→ 0-based positions, -1 for no match.- Return type:
- ecotyper.rcompat.frame.r_merge(x, y, by, all_x=False, all_y=False, suffixes=('.x', '.y'), x_factor=False)[source]¶
merge(x, y, by = by, all.x, all.y)for a single key column.Rows: matched pairs, then unmatched x, then unmatched y, finally stably ordered by the key (
sort = TRUE). Columns: key, remaining x columns, remaining y columns (duplicates suffixed). The row index is reset (R gives 1..n).x_factor=True: the key ofxis a factor (e.g. fromas.data.frame(table(..))) andall.yis set. R’s final sort then orders by the integer factor codes:rbindappends the unmatched y keys as new levels after x’s levels, so they stay in y order after the matched rows instead of being sorted alphabetically.