`name` is the name of the category (or group).
-A `Leaf` represents a leaf category. The `Leaf`'s `leaf-index` is a
-nonnegative integer unique within the `Dimension` and less than
-`n-categories` in the Dimension. If the user does not sort or
-rearrange the categories, then `leaf-index` starts at 0 for the first
-`Leaf` in the dimension and increments by 1 with each successive
-`Leaf`. If the user does sort or rearrange the categories, then the
-order of categories in the file reflects that change and `leaf-index`
-reflects the original order.
+A `Leaf` represents a leaf category. The `Leaf`'s `leaf-index` is
+ordinarily a integer unique within the `Dimension` in the range
+`0..n-categories`:
+
+- If the user does not sort or rearrange the categories, then
+ `leaf-index` starts at 0 for the first `Leaf` in the dimension and
+ increments by 1 with each successive `Leaf`.
+
+- If the user does sort or rearrange the categories, then the order of
+ categories in the file reflects that change and `leaf-index`
+ reflects the original order.
+
+- A `leaf-index` of -1 indicates a deleted category. A reader can
+ ignore these categories. The remaining `n` categories have
+ `leaf-index` in the range `0..n`.
A dimension can have no leaf categories at all. A table that
contains such a dimension necessarily has no data at all.
.iter()
.map(|cell| {
(
- PrecomputedIndex(cell.index as usize),
+ PrecomputedIndex(dbg!(cell.index) as usize),
cell.value.decode(encoding, &footnotes, warn),
)
})
let name = self.name.decode(encoding, footnotes, warn);
match &self.child {
Child::Leaf { leaf_index } => {
- ptod.push(*leaf_index as usize);
- group.push(pivot::Leaf::new(name));
+ if *leaf_index >= 0 {
+ ptod.push(*leaf_index as usize);
+ group.push(pivot::Leaf::new(name));
+ }
}
Child::Group {
merge: true,
#[br(magic(0u16), parse_with(parse_bool), temp)]
_x24: bool,
#[br(magic(b"\x02\0\0\0"))]
- leaf_index: u32,
+ leaf_index: i32,
#[br(magic(0u32), temp)]
_tail: (),
},
test_raw_spvfile("light5", None);
}
+/// Test categories to be deleted due to negative `leaf-index`.
+#[test]
+fn light6() {
+ test_raw_spvfile("light6", None);
+}
+
#[test]
fn legacy1() {
test_raw_spvfile("legacy1", None);
--- /dev/null
+ Hypothesis Test Summary
+ Null Hypothesis │ Test │Sig.[a,b]│ Decision
+─────────────────────────────────────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────┼─────────┼───────────────────────────
+1 The distributions of Variable0000001, Variable0000002 and Variable0000003 are the same.│Related-Samples Friedman's Two-Way Analysis of Variance by Ranks│ .164│Retain the null hypothesis.
+─────────────────────────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────┴─────────┴───────────────────────────
+a. The significance level is .050.
+b. Asymptotic significance is displayed.
--- /dev/null
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ Frequency│Percent
+────────────────────────┼───────
+Missing System 21│ 100.0
+────────────────────────┴───────