# NOT RUN {
# Basic examples:
mfv(integer(0)) # NaN
mfv(c(3, 3, 3, 2, 4)) # 3
mfv(c(TRUE, FALSE, TRUE)) # TRUE
mfv(c("a", "a", "b", "a", "d")) # "a"
mfv(c("a", "a", "b", "b", "d")) # c("a", "b")
mfv1(c("a", "a", "b", "b", "d")) # "a"
# With missing values:
mfv(c(3, 3, 3, 2, NA)) # 3
mfv(c(3, 3, 2, NA)) # NA
mfv(c(3, 3, 2, NA), na_rm = TRUE) # 3
mfv(c(3, 3, 2, 2, NA)) # NA
mfv(c(3, 3, 2, 2, NA), na_rm = TRUE) # c(2, 3)
mfv1(c(3, 3, 2, 2, NA), na_rm = TRUE)# 2
# With only missing values:
mfv(c(NA, NA)) # NA
mfv(c(NA, NA), na_rm = TRUE) # NaN
# With factors
mfv(factor(c("a", "b", "a")))
mfv(factor(c("a", "b", "a", NA)))
mfv(factor(c("a", "b", "a", NA)), na_rm = TRUE)
# }
Run the code above in your browser using DataLab