Description Usage Arguments Value Examples
Create an Object Feature
1 | feature(expr)
|
expr |
expression |
a Q7 feature
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | Type1 <- type(function(num){})
hasMagic <- feature({
change_number <- function(){
num + 1
}
})
myType1 <- Type1(1) %>% hasMagic()
myType1$change_number()
# Use S3 method dispatch for different behaviors
hasMagic <- feature_generic(s3 = "hasMagic")
hasMagic.Type1 <- feature({
change_number <- function(){
num + 1
}
})
hasMagic.Type2 <- feature({
change_number <- function(){
num - 1
}
})
Type1 <- type(function(num){},
s3 = "Type1") %>%
hasMagic()
Type2 <- type(function(num){},
s3 = "Type2") %>%
hasMagic()
myType1 <- Type1(1)
myType1$change_number()
myType2 <- Type2(1)
myType2$change_number()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.