课程: R for Data Science: Lunch Break Lessons

免费学习该课程!

今天就开通帐号,24,100 门业界名师课程任您挑!

debugonce

debugonce

- [Instructor] When you start debugging code in R, there are two commands you'll want to know about. One of them is debug and the second is debug once. Let's take a look at how to use those. First I've declared a simple function. All it does is print a number. Now let's set debug on that function and to do that, I use the command debug and the name of the function. This is a function, just like that. Now when I hit return nothing much happens until I run it. So let's set up a loop here for Index one in 10. It's gonna call this is a function with that number 10 times. Let's go ahead and run that and see what happens. Now you'll notice that we immediately dropped into the browser and we've talked about the browser before. If you look in the upper left hand corner you'll see that the green arrow indicates we're stepping into this function. If I hit next, it prints out. I get the number, but it keeps going. It's gonna do this 10 times. Each time running through that routine. Well if this…

内容