You can see if your function uses R's random number generator with the following function.
isRandom <- function(expr) { randomSeedBefore <- get0(".Random.seed") force(expr) !identical(randomSeedBefore, get0(".Random.seed")) } isRandom(1:10) #[1] FALSE isRandom(runif(3)>.4) #[1] TRUE It gives a false negative if a function restores .Random.seed after making some random numbers, but that is fairly uncommon. It may give misleading results if you use functions like parLapply. Bill Dunlap TIBCO Software wdunlap tibco.com On Fri, Dec 15, 2017 at 8:52 AM, MacQueen, Don <macque...@llnl.gov> wrote: > You could try this and see what you get: > > unique( yguii(ZEEL.NS, "o") - yguii(ZEEL.NS, "o") ) > > or maybe > > table( yguii(ZEEL.NS, "o") - yguii(ZEEL.NS, "o") ) > > You showed two sets of output from the expression > yguii(ZEEL.NS, "o") > > Were they done one right after the other? Or could ZEEL.NS have changed in > between? > > The function could be using a variable that's only defined in the global > environment (presumably by mistake, but it's an easy mistake to make), and > its value changed in between function calls. > > Reinstalling R would be a waste of time. > > -Don > > -- > Don MacQueen > Lawrence Livermore National Laboratory > 7000 East Ave., L-627 > Livermore, CA 94550 > 925-423-1062 > Lab cell 925-724-7509 > > > > On 12/15/17, 4:45 AM, "R-help on behalf of akshay kulkarni" < > r-help-boun...@r-project.org on behalf of akshay...@hotmail.com> wrote: > > dear Members, > > > > Today something weird has happened on my R console. I have attached > two screenshots of the same vector in my R console but they differ. > > > Also one of my function returns negative values, even after double > checking the code, which should return only positive values.. > > > Whats wrong..? Reinstall R? > > > Thanks for help.... > > > AKSHAY M KULKARNI > > > > > ______________________________________________ > 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.