Chris_Rands Chris_Rands - 3 months ago 12
R Question

R equivalent of Python 'pass' statement

Python has a

statement, a null operation, which can be a useful placeholder before code is complete, for example in Python:

def example_function():
pass
# stuff to do here


Is there an equivalent in R? Thank you.

Answer

Just have an empty function body:

foo = function(){
 }

You should probably also add a comment, and a warning maybe?

foo = function(){
# write this tomorrow
 warning("You ran foo and I havent written it yet")
}

Same thing with an if expression:

if(x==1){
  # do this bit later
  }else{
  message("x isnt 1")
}
Comments