R/as.data.frame.light.edsurvey.data.frame.R

Defines functions as.data.frame.light.edsurvey.data.frame

Documented in as.data.frame.light.edsurvey.data.frame

#' @name as.data.frame
#' @title Coerce to a Data Frame
#'
#' @description Function to coerce a \code{light.edsurvey.data.frame} to a \code{data.frame}.
#' @param x a \code{light.edsurvey.data.frame}
#' @param ... other arguments to be passed to \code{\link[base]{as.data.frame}}
#' @return a \code{data.frame}
#' @export
#'
#' @author Trang Nguyen
as.data.frame.light.edsurvey.data.frame <- function(x, ...) {
  res <- x
  atrs <- names(attributes(x))
  atrs <- atrs[!atrs %in% c("names", "row.names", "class")]
  # remove edsurvey-related attributes
  for (z in atrs) {
    attr(res, z) <- NULL
  }
  class(res) <- "data.frame"
  res
}

Try the EdSurvey package in your browser

Any scripts or data that you put into this service are public.

EdSurvey documentation built on Nov. 2, 2023, 6:25 p.m.