lapply() output as a dataframe of multiple functions - R
问题 I have been trying to create a new dataframe from several computations with lapply() . I have reached this so far reading several questions (1, 2, 3): lapply(mtcars, function(x) c(colnames(x), NROW(unique(x)), sum(is.na(x)), round(sum(is.na(x))/NROW(x),2) ) ) However, colnames(x) doesn't give the colname as x it's a vector. Second, I can't figure out a way to transform this output into a dataframe: lapply(mtcars, function(x) data.frame(NROW(unique(x)), # if I put colnames(x) here it gives an