r - Is it possible to report NAs in stargazer table? -
stargazer package gives me nice descriptive table include in latex document.
library(stargazer) stargazer(attitude)
is possible add column reporting number of nas each of variables?
this snippet give number of nas per row , column in data frame
# make data count <- 10 data <- data.frame( a=runif(count), b=runif(count)) # add nas data[data$a>0.5,]$a <- na data[data$b>0.5,]$b <- na # nas per row data$nacount <- apply(data, 1, function(x) {length(x[is.na(x)])}) # nas per column nacountsbycolumn <- lapply(data, function(x) {length(x[is.na(x)])} )
Comments
Post a Comment