R/naValuesColumnsTable.R

Defines functions naValuesColumnsTable

Documented in naValuesColumnsTable

#'naValuesColumnsTable
#' @param dfData a data.frame object. Note that this is not a character string but the data.frame object itself. The parameter passed to the function should be without quotes (" ").
#' @return naValuesColumnsTable returns a data.frame object containing the column name, column number, NA count and the corresponding row location(s) of NA values for each column in \code{dfData} 
#' @description naValuesColumnsTable takes as input a data.frame object (\code{dfData}) and returns a data.frame object displaying the column name, column number, NA count and the corresponding row location(s) of NA values for each column in \code{dfData} 
#' @examples
#' naValuesColumnsTable(warpbreaks)
#' naValuesColumnsTable(iris)
#' @export
naValuesColumnsTable <- function(dfData){
  naTable<-data.frame()
  for (i in 1:length(dfData[]))
  {
    rowNaTable <- data.frame(ColumnNumber = i,NACount = colSums(is.na(dfData[i])),RowsNaValues=paste(which(is.na(dfData[i])),collapse=","))
    naTable <- rbind(naTable, rowNaTable)
  }
  return(naTable)
}
lwTools/agriTrf documentation built on March 26, 2020, 12:09 a.m.