课程: R for Data Science: Lunch Break Lessons

免费学习该课程!

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

browser

browser

- [Instructor] Sometimes the code you've written just doesn't behave the way you want it to and when that happens it's really handy to have debugger functionality. So let's take a look at Browser, which is one of the debugger commands in R. To demonstrate this, I've created a function called Print My Number. It's up here in line four through six and all Print My Number does is print the number that it's been given. Then the line eight through 13 I've declared a second function called thisisafunction and it takes a number, it sets a variable called Keep Running to True and while true is true, it prints my number. Let's define that real quick. Now I can call thisisafunction with the number four and what we'll get is an endless loop of four. So let's go in and take a look at what's going on. I can hit stop and I'm going to add a line to thisisafunction called Browser. And that's an R debugging command. So let's redefine thisisafunction and now when I call thisisafunction, several things…

内容