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 to do it...

Here are the following few steps to complete this recipe:

  1. Import the dataset.
  2. Write the customized function.
  3. Use the newly defined function in the dplyr framework.

Here are the necessary code blocks to implement all the preceding three steps:

        USAairlineData2016 <- read.csv("USAairlineData2016.csv", as.is                = T)        # the new customized function to calculate summary statistics        fourNumSum <- function(x){         MIN_DELAY = min(x, na.rm=T)         MEAN_DELAY = mean(x, na.rm=T)         MEDIAN_DELAY = median(x, na.rm=T)         MAX_DELAY = max(x, na.rm=T)         return(data.frame(MIN_DELAY=MIN_DELAY, MEAN_DELAY=MEAN_DELAY,           MEDIAN_DELAY=MEDIAN_DELAY, MAX_DELAY=MAX_DELAY))        }
  1. Now, the fourNumSum function will be used within the dplyr framework to carry out the task as ...
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