type
Type of objects to count. If type=="history.account" | type=="account", use the default behavior for length().
Otherwise (if type is portfolio, portfolio.bond, cash, bond), return vector counts (each element is a particular time period) of the requested object type.