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

This is a revised implementation for #137 , now hopefully correct