R/datasummary.R

Defines functions datasummary

Documented in datasummary

#' datasummary 
#' 
#' This function provides a simple print out of common data summarisation functions from base R
#' 
#' @param data a dataframe
#' @return a print to console of output
#' @author Dean Marchiori
#' @details 
#' The function accepts a dataframe object and runs a number of data summary 
#' functions to describe the size, structure and contents of the data frame
#' @export 
#'  

datasummary <- function(data){
  
  print("===================================")
  print("COLUMN NAMES")
  print("===================================")
  
  print(colnames(data))
  
  # Print Data dimensions
  print("===================================")
  print("DATA DIMENSIONS")
  print("===================================")
  
  print(paste("dataframe length:", dim(data)[1]))
  print(paste("dataframe width:", dim(data)[2]))
  
  print("===================================")
  print("DATA STRUCTURES")
  print("===================================")
  
  str(data)
  
  print("===================================")
  print("DATA SUMMARY")
  print("===================================")
  
  print(summary(data))
  
  # Missing Values
  print("===================================")
  print("MISSING VALUES")
  print("===================================")
  
  print(sapply(X= data, FUN= function(x) sum(is.na(x))))
  
}
deanmarchiori/dataexplorer documentation built on May 12, 2017, 9:53 p.m.