Question
MUST BE DONE IN R LANGUAGE! Fill blanks in the function my.fun() so that for a given list, the function returns all locations of each
MUST BE DONE IN R LANGUAGE!
Fill blanks in the function my.fun() so that for a given list, the function returns all locations of each element and sort the frequency of the elements in increasing order. Then apply my.fun() to a set of gender: F F M M M M I I F I F M I F M I I M I I F
Where F, M and I represent Female, Male and Infant respectively.
my.fun <- function(f){ y <- unlist(f) x <- ___________ for (i in 1:____){ g1 <- y[i]
x[[______]] <- c(x[[____]],i) } freq <- _________(x, length) z <- sort(________, decreasing = ____) lst <- list(x, z) ___________(lst) } gender <- list( F, ________________________________, F) __________(gender) #
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started