moved writeData data.frame coercion to s3