Rewrite it with spaces between your assigns and numbers. This line is unclear to me: if(rst[i]<-3 & rst[i]>=-3)
Is it supposed to be rst[i] <- 3, or rst[i] < -3? R might be misinterpreting what you're trying to get it to do. On Mon, Jan 12, 2015 at 1:18 AM, Methekar, Pushpa (GE Transportation, Non-GE) <pushpa.methe...@ge.com> wrote: > 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]] > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.