R/naValuesRowsTable.R

Defines functions naValuesRowsTable

Documented in naValuesRowsTable

#'naValuesRowsTable
#' @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 naValuesRowsTable returns a data.frame object containing the first column of \code{dfData} (this column is used as row name in the output data.frame object), NA count and the corresponding columnn number(s) of NA values for each row in \code{dfData} 
#' @description naValuesRowsTable takes as input a data.frame object (\code{dfData}) and returns a data.frame object displaying the first column of \code{dfData} as row name, NA count and the corresponding columnn number(s) of NA values for each row in \code{dfData} 
#' @examples
#' naValuesRowsTable(warpbreaks)
#' naValuesRowsTable(iris)
#' @export
naValuesRowsTable<- function(dfData){
  naTable<-data.frame()
  for (i in 1:length(dfData[,1]))
  {
    rowNaTable <- data.frame(RowName = dfData[i,1], NACount = rowSums(is.na(dfData[i,])),ColsNaValues=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.