0
0
R Programmingprogramming~10 mins

Debugging tools in R Programming - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to print the current call stack.

R Programming
[1]()
Drag options to blanks, or click blank then click option'
Atraceback
Btraceback_print
Attempts:
3 left
💡 Hint
Common Mistakes
Using a function name that does not exist in the traceback package.
Trying to print the call stack without calling the correct function.
2fill in blank
medium

Complete the code to start debugging a function call.

R Programming
debug([1])
Drag options to blanks, or click blank then click option'
Amy_function
Bprint
Csummary
Dplot
Attempts:
3 left
💡 Hint
Common Mistakes
Passing a function call instead of a function name.
Using a built-in function that is not the target for debugging.
3fill in blank
hard

Fix the error in the code to stop debugging the function.

R Programming
undebug([1])
Drag options to blanks, or click blank then click option'
Amy_function()
Bstop
Cdebug
Dmy_function
Attempts:
3 left
💡 Hint
Common Mistakes
Including parentheses when passing the function name.
Passing a string instead of the function object.
4fill in blank
hard

Fill both blanks to print the last error message and then clear it.

R Programming
print([1]())
[2]()
Drag options to blanks, or click blank then click option'
Alast_error
Cgeterrmessage
Attempts:
3 left
💡 Hint
Common Mistakes
Using a non-existent function like last_error.
Not calling the function to clear the error message.
5fill in blank
hard

Fill all three blanks to run code with error handling and print a custom message.

R Programming
tryCatch([1]("a"), error = function(e) {
  print(paste('Error:', [2]))
  [3]()
})
Drag options to blanks, or click blank then click option'
Alog
Be$message
Cstop
Dmean
Attempts:
3 left
💡 Hint
Common Mistakes
Using a function that does not cause errors for demonstration.
Not accessing the error message correctly.
Not stopping execution after printing the error.