Unable to use readline() for function() input I recently started learning R and was trying to make a script that would give specific values of a probability distribution. Ideally, in this script, there would be a list of probability distributions with an associated number. Users would be able to enter a number and it would print out a message while giving them a bunch of variables relevant to the specific probability distribution to enter.

This is my code:

DistriName &lt;- readline(prompt = "Enter Distribution: ")
DistriName &lt;- as.numeric(DistriName)
function(DistriName) {
  if(DistriName = 1) {
    print("You have selected the binomial distribution")
  } else {
    print("I am not familiar with the distribution. Sorry.")
  }
}


For some reason, it keeps giving me this error:

Error: unexpected '}' in "  }"
Error: unexpected '}' in "}"


I have checked multiple times for any missing opening brackets, but could not find anything.
Try

if (DistriName == 1)


(two == means "is equal“ in a logical way)