I have a follow up question on this question. Suppose I want an own +
function for my class expo
. On my normal R session the following works perfectly
'+.expo' <- function(a, b) a ^ b
r <- 2; class(r) <- "expo"
s <- 3; class(s) <- "expo"
r + s # gives 8
But running devtools::document()
gives me the Skipping invalid path: .expo.Rd
message. If I understand this question correctly, '+.expo'
is an invalid name for a function as each function has to start with a (small or capital) letter. Now I wonder how can ggplot2
provide a function '+.gg'
? And more importantly: how can my package provide a class-specific +
functions?