True/False - proportion

How to find the proportion of True and False?

N <- 50
set.seed(42)
object <- sample(c(TRUE,FALSE),N,replace = TRUE)
object
#>  [1]  TRUE  TRUE  TRUE  TRUE FALSE FALSE FALSE FALSE  TRUE FALSE  TRUE FALSE
#> [13]  TRUE FALSE  TRUE  TRUE FALSE FALSE FALSE FALSE  TRUE  TRUE  TRUE  TRUE
#> [25]  TRUE FALSE  TRUE  TRUE  TRUE  TRUE FALSE FALSE FALSE FALSE  TRUE FALSE
#> [37]  TRUE FALSE FALSE FALSE  TRUE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE
#> [49] FALSE  TRUE
table(object)/N
#> object
#> FALSE  TRUE 
#>  0.54  0.46

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.