11.07.2015 Views

Introductory Slides for R - Statistics

Introductory Slides for R - Statistics

Introductory Slides for R - Statistics

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Another Way to Construct FunctionsWe can define the function object Pythagoras directly from the command line.> Pythagoras Pythagorasfunction(x,y){sqrt(xˆ2+yˆ2)}> Pythagoras(1:3,2:4)[1] 2.236068 3.605551 5.000000Note the + character replacing the prompt > when the command is incomplete.This prompts you to complete an incomplete expression.A function expression is not complete until the opening { is matched by a closing }26

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!