Untitled

 avatar
unknown
plain_text
5 months ago
279 B
8
Indexable
# R program to find mean, mode, and median

vec <- c(1, 2, 3, 4, 5, 5, 6)

# Mean
mean_val <- mean(vec)
print(mean_val)
# Median
median_val <- median(vec)
print(median_val)
# Mode
mode_val <- as.numeric(names(sort(table(vec), decreasing = 
TRUE)[1]))
print(mode_val)
Editor is loading...
Leave a Comment