[R] global environment

Methekar, Pushpa (GE Transportation, Non-GE) pushpa.methekar at ge.com
Mon Jan 12 09:18:13 CET 2015


Hi
I am trying to make some changes in data frame and return it to function .this is my function
rm.outliers = function(model,xsys)
{

  rst = rstudent(model)
  outliers<<-vector("numeric",10)
  xsys<<-xsys
for(i in 1:length(rst))
  {
    if(rst[i]<-3  & rst[i]>=-3)
      {
      #print("this is not outlier")
      print(i)
    }
    else
      {
      print("this is an outlier")
      print(i)
      outliers[i]<<-c(i)
      print(outliers)

    }

    i<-i+1
  }

xsys<-xsys[-outliers,]
print(" printing rows")
nrow(xsys)
return(xsys)
}
After returning xsys dataframe its not making changes in my global environment data frame.
I tried assign and <<- but no use.

	[[alternative HTML version deleted]]



More information about the R-help mailing list