I have a dataframe with only TRUE/FALSE values
tf <- as.data.frame(matrix(c(rep(TRUE,5),rep(FALSE,5)),10,10))
and I want to calculate the percentage of TRUE values for each column. Thus I wrote the following apply function, which however only returns an empty vector:
overlay <- apply(tf,2,function(x) sum(x == TRUE)/nrow(x))
What am I doing wrong?