1)set.seed(1)n=5000gender=sample(c("f","m"),size=n,TRUE)dechot=function(gender,type){n=length(gender)list=c(NA,n)for(iin1:n){list[i]=switch(gender[i],"f"=type[1],"m"=type[2])}return(list)}type=