Skip to Content
Modern R Programming Cookbook
book

Modern R Programming Cookbook

by Jaynal Abedin
October 2017
Beginner to intermediate
236 pages
7h 38m
English
Packt Publishing
Content preview from Modern R Programming Cookbook

How it works…

To write a function in R, there is a keyword in R called function. Using this keyword, you can write any type of customized function in R. In this recipe, the task is as follows:

  1. Write a function that will take a numeric vector as input.
  2. Then, it will calculate the mean and standard deviation internally.
  3. Finally, it will give an output of the ratio of the standard deviation and mean.

Each of the input parameters is called the argument of a function. In this recipe, the input argument is vectorInput. You can use any numeric input vector to specify the input of this function by passing the argument as vectorInput=V1.

Within the curly braces, the actual calculation happened. In this case, the mean and standard deviation has been ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

R Cookbook, 2nd Edition

R Cookbook, 2nd Edition

JD Long, Paul Teetor

Publisher Resources

ISBN: 9781787129054Supplemental Content