R is a programming language and software environment for statistical computing and graphics. It was created by Ross Ihaka and …