#'as.data.frame
#'
#'Converts PFm model to data.frame
#'@param object Expected PFm model
#'@return data.frame constructed on the base of PFm model.
#'@export
as.data.frame.PFm <- function(object){
result <- as.data.frame(object$data)
result$sigmoid <- rep(object$sigmoid, nrow(result))
result <- tidyr::nest(result, -c(sigmoid))
result$core <- rep(object$core, nrow(result))
result$gamma <- rep(object$gamma, nrow(result))
result$lambda <- rep(object$lambda,nrow(result))
for(i in 1:length(object$params)){
name <- paste("param", as.character(i), sep=".")
result[[name]] <- rep(object$params[1],nrow(result))
}
result$value <- object$value
if(!is.null(object$counts[1])){result$counts.1 <- object$counts[1]}
if(!is.null(object$counts[2])){result$counts.2 <- object$counts[2]}
if(!is.null(object$convergence)){ result$convergence <- object$convergence}
if(!is.null(object$hessian)){ result$hessian <- object$hessian}
result$message <- object$message
result <- tidyr::unnest(result)
return(result)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.