Convert subdim() into S3 generic