The ratio is calculated as the number of 1s minus the number of 0s. A positive ratio indicates that there are more 1s than 0s, while a negative results indicates the opposite. NA
are not accounted to calculate the length of the vector.
Details
By using the hamming_weight function, the ratio can be calculated in the following way. $$Ratio = \frac{HW(v) - (\#v - HW(v))}{\#v} = 2 \cdot HW_{norm}(v) - 1$$ The operator \(\#v\) denotes the number of elements in the vector \(v\).