Use R Studio (show the code and output)
Please write an R function named “outlier_detect” to return or print out the outliers from a given data vector. outlier_detect = function(x){ #x: a column of numeric vector Body of code }
ANSWER - R code pasted below. We can use boxplot for getting the outliers.
#function definition for detecting outliers
outlier_detect <- function(x)
{
outlier = boxplot(x)$out
cat(outlier,"\n")
}
#function calling
#vector x
x<-c(1,2,50,45,67,200,230,55,56,49)
outlier_detect(x)
Output Screen
Get Answers For Free
Most questions answered within 1 hours.