0

I'm trying to make a function to remove outliers.

 removeoutlier<-
  function(data,datacolumn){


Q<-quantile(datacolumn, probs=c(0.1,0.9),  na.rm = FALSE)

iqr <- IQR(datacolumn)
up <-  Q[2]+1.5*iqr # Upper Range  
low<- Q[1]-1.5*iqr # Lower Range


nooutlier2<-iris[iris$Sepal.Width > (Q[1] - 1.5*iqr) & iris$Sepal.Width < (Q[2]+1.5*iqr),]

return(nooutlier2)

}

I'd like to store values. But function only displayed values and not store the values. How would I store values returned by function? Thanks in advance!

JH LEE
  • 21
  • 2

1 Answers1

0

You can assign it in the global environment: assign(name, nooutlier2, envir = .GlobalEnv)