Generate .id column as factor in ldply(); fixes #137

This is a revised implementation, now hopefully correct