#' @title As Amartha
#' @description as_amartha is a generic function to generate particular Amartha objects.
#' Currently, there are two kinds of object, num and df to attach data.frame and numeric inherited objects.
#' It is not replace the original class of the object to avoid main functionality.
#' @param x : it can be a vector or data.frame for now
#' @export
as_amartha <- function(x) {
UseMethod("as_amartha")
}
#' @export
as_amartha.data.frame <- function(x) {
class(x) <- c(class(x), "Amartha_df")
return(x)
}
#' @export
as_amartha.numeric <- function(x) {
class(x) <- c(class(x), "Amartha_num")
return(x)
}
#' @export
as_amartha.lm <- function(x) {
class(x) <- c(class(x), "Amartha_linear_model")
return(x)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.