Dear All I have a program that breaks at the following lines of code: bigfunction { ... object1 = myfunction(x) object2 = strsplit(object1, ",")[[1]] ... } where myfunction is defined elsewhere outside of bigfunction. The error I get is "error in strsplit() -- object1 not found". However, when I insert browser() into my code so that the above reads, bigfunction { ... browser() object1 = myfunction(x) object2 = strsplit(object1, ",")[[1]] ... } my entire program runs successfully, and oddly *never enters browser mode*. Has anyone encountered a similar problem? Any advice would be greatly appreciated. Thank you, Michelle -- View this message in context: http://r.789695.n4.nabble.com/program-never-enters-browser-mode-when-I-add-browser-tp3948920p3948920.html Sent from the R help mailing list archive at Nabble.com.
Jeff Newmiller
2011-Oct-28 21:04 UTC
[R] program never enters browser mode when I add browser()
Short answer: I have not. Long answer: Read the posting guide. Provide a reproducible example. Show actual error messages. Identify your operating system and version of R. Read the posting guide. Then try posting again. --------------------------------------------------------------------------- Jeff Newmiller The ..... ..... Go Live... DCN:<jdnewmil@dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/Batteries O.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --------------------------------------------------------------------------- Sent from my phone. Please excuse my brevity. "M. Tran" <michellev.tran@gmail.com> wrote: Dear All I have a program that breaks at the following lines of code: bigfunction { ... object1 = myfunction(x) object2 = strsplit(object1, ",")[[1]] ... } where myfunction is defined elsewhere outside of bigfunction. The error I get is "error in strsplit() -- object1 not found". However, when I insert browser() into my code so that the above reads, bigfunction { ... browser() object1 = myfunction(x) object2 = strsplit(object1, ",")[[1]] ... } my entire program runs successfully, and oddly *never enters browser mode*. Has anyone encountered a similar problem? Any advice would be greatly appreciated. Thank you, Michelle -- View this message in context: http://r.789695.n4.nabble.com/program-never-enters-browser-mode-when-I-add-browser-tp3948920p3948920.html Sent from the R help mailing list archive at Nabble.com. _____________________________________________ R-help@r-project.org mailing list 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]]
Joshua Wiley
2011-Oct-29 02:33 UTC
[R] program never enters browser mode when I add browser()
Hi Michelle, In addition to Jeff's advice, can you now reproduce the original error? What you are describing is highly improbable if everything is properly executed. It becomes more likely if more was chagned between running than just inserting browser(). For example, if you reran/had made changes in other code you forgot to run and then sourced that into R in addition to having added browser() to bigfunction. If browser() was really run, it should have come up, perhaps somewhere in .... is something made the function return a value and terminate or your code is written in such a way that the portion that browser() was in was not run. Right now this is all just speculation, further help will really require more details to work with. Cheers, Josh On Fri, Oct 28, 2011 at 12:04 PM, M. Tran <michellev.tran at gmail.com> wrote:> Dear All > > I have a program that breaks at the following lines of code: > > bigfunction > { > ... > > object1 = myfunction(x) > object2 = strsplit(object1, ",")[[1]] > > ... > } > > where myfunction is defined elsewhere outside of bigfunction. > > The error I get is "error in strsplit() -- object1 not found". > > However, when I insert browser() into my code so that the above reads, > > bigfunction > { > ... > > browser() > object1 = myfunction(x) > object2 = strsplit(object1, ",")[[1]] > > ... > } > > my entire program runs successfully, and oddly *never enters browser mode*. > > Has anyone encountered a similar problem? ?Any advice would be greatly > appreciated. > > Thank you, > Michelle > > -- > View this message in context: http://r.789695.n4.nabble.com/program-never-enters-browser-mode-when-I-add-browser-tp3948920p3948920.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > 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. >-- Joshua Wiley Ph.D. Student, Health Psychology Programmer Analyst II, ATS Statistical Consulting Group University of California, Los Angeles https://joshuawiley.com/
Patrick Burns
2011-Oct-29 09:57 UTC
[R] program never enters browser mode when I add browser()
I see two possibilities: 1) the call to 'browser' is inside an 'if' clause that doesn't exectute. 2) the call forgets the parentheses, so it is: browser rather than browser() On 28/10/2011 20:04, M. Tran wrote:> Dear All > > I have a program that breaks at the following lines of code: > > bigfunction > { > ... > > object1 = myfunction(x) > object2 = strsplit(object1, ",")[[1]] > > ... > } > > where myfunction is defined elsewhere outside of bigfunction. > > The error I get is "error in strsplit() -- object1 not found". > > However, when I insert browser() into my code so that the above reads, > > bigfunction > { > ... > > browser() > object1 = myfunction(x) > object2 = strsplit(object1, ",")[[1]] > > ... > } > > my entire program runs successfully, and oddly *never enters browser mode*. > > Has anyone encountered a similar problem? Any advice would be greatly > appreciated. > > Thank you, > Michelle > > -- > View this message in context: http://r.789695.n4.nabble.com/program-never-enters-browser-mode-when-I-add-browser-tp3948920p3948920.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > 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. >-- Patrick Burns pburns at pburns.seanet.com twitter: @portfolioprobe http://www.portfolioprobe.com/blog http://www.burns-stat.com (home of 'Some hints for the R beginner' and 'The R Inferno')