R/employee-class.R

#' Am example

setClass("employee",representation(
      name = "character",
      salary = "numeric",
      union = "logical",
      info = "data.frame"
  )
)

setMethod("show","employee",
          function(object){
            inorout<-ifelse(object@union,"is","is not")
            cat(object@name,"has a salary of", object@salary,
                "and",inorout,"in the union","\n")
          })
ritianjiang/MethyAge2 documentation built on Dec. 3, 2019, 2:03 p.m.