new tasks

This commit is contained in:
Ingy döt Net 2013-04-09 00:46:50 -07:00
parent 2a4d27cea0
commit 80737d5a6a
1194 changed files with 15353 additions and 1 deletions

View file

@ -0,0 +1,24 @@
setClass("circle",
representation(
radius="numeric",
centre="numeric"),
prototype(
radius=1,
centre=c(0,0)))
#Instantiate class with some arguments
circS4 <- new("circle", radius=5.5)
#Set other data slots (properties)
circS4@centre <- c(3,4.2)
#Define a method
setMethod("plot", #signature("circle"),
signature(x="circle", y="missing"),
function(x, ...)
{
t <- seq(0, 2*pi, length.out=200)
#Note the use of @ instead of $
plot(x@centre[1] + x@radius*cos(t),
x@centre[2] + x@radius*sin(t),
type="l", ...)
})
plot(circS4)