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…

The objective was to take the logarithm of a given numeric vector that contains a zero and negative numbers. The function is implemented in the following three different ways and their outputs are different:

  • stop(): This function generates a customized error message based on the condition supplied. In this example, the condition was to look for any number less than or equal to zero. If there is such a number, then the function will print the error message as, "A negative value exists", and the function will stop producing any other output. Finally, the only error message will be displayed on the R console.
  • try(): This function has been used to handle an exception situation. This function tests the expression inside the try() ...
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