Creating custom objects and methods in R using the S3 system