[R] Still confused about classes

2011-04-29 Thread Russ Abbott
Hi, I'm still confused about how to find out what methods are defined for a given class. For example, I know that today - Sys.Date() will produce an object of type Date. But I'm not sure what I can do with Date objects or how I can find out. ?Date refers me to the Date documentation page.

Re: [R] Still confused about classes

2011-04-29 Thread Joshua Wiley
Hi Russ, One tool that might help could be ?methods and ?showMethods For example: ## for S3 methods(class = Date) ## for S4 showMethods(classes = Date) regarding getting the actual year, I would use (though there may be better ways): format.Date(as.Date(2010-01-01), format = %Y) HTH, Josh

Re: [R] Still confused about classes

2011-04-29 Thread Prof Brian Ripley
See ?months. methods(class = Date) would have got you there. (Date is not an S4 class, so people should not be setting S4 methods on it without very good reason, and there are none in R itself.) On Thu, 28 Apr 2011, Joshua Wiley wrote: Hi Russ, One tool that might help could be ?methods

Re: [R] Still confused about classes

2011-04-29 Thread Kenn Konstabel
The function for getting the year from date is there in package lubridate (as well as many other convenient functions to work with dates). More generally, finding all methods for a given class may be a little tricky. If all means everything you have installed and currently attached to your

Re: [R] Still confused about classes

2011-04-29 Thread Russ Abbott
Thanks, to all. I didn't know about either *methods( ) *or the package * lubridate*, which seems like a very nice *Date *package. *-- Russ * On Fri, Apr 29, 2011 at 1:35 AM, Kenn Konstabel lebats...@gmail.com wrote: The function for getting the year from date is there in package lubridate