From 8e77109651f6118646840b8ba10c7b33f93b2518 Mon Sep 17 00:00:00 2001 From: shafayetShafee Date: Fri, 17 Jun 2022 15:25:52 +0600 Subject: [PATCH] using dplyr::bind_rows instead of rbind_all() in chapter-01 --- 01-introduction.Rmd | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/01-introduction.Rmd b/01-introduction.Rmd index 9c8a1f5..4ac5b04 100644 --- a/01-introduction.Rmd +++ b/01-introduction.Rmd @@ -18,12 +18,13 @@ As emphasised in the next section, it's useful to run code and experiment as you - A working installation of R on your computer (see Section \@ref(install-rstudio)). -- Install and load the **microbenchmark**, **profvis** and **ggplot2** packages (see Section \@ref(installing-r-packages) for tips on installing packages and keeping them up-to-date). You can ensure these packages are installed by loading them as follows: +- Install and load the **microbenchmark**, **profvis**, **readr** and **ggplot2** packages (see Section \@ref(installing-r-packages) for tips on installing packages and keeping them up-to-date). You can ensure these packages are installed by loading them as follows: ```{r} library("microbenchmark") library("profvis") library("ggplot2") +library("readr") ``` The prerequisites needed to run the code contained in the entire book are covered in \@ref(book-resources) at the end of this chapter. @@ -186,8 +187,10 @@ profvis(expr = { library("ggplot2") # Stage 2: load and process data - out = readRDS("extdata/out-ice.Rds") - df = dplyr::rbind_all(out, id = "Year") + extdata_path <- + "https://raw.githubusercontent.com/csgillespie/efficientR/master/extdata/" + out <- readr::read_rds(paste0(extdata_path, "out-ice.Rds")) + df <- dplyr::bind_rows(out, .id = "Year") # Stage 3: visualise output ggplot(df, aes(long, lat, group = paste(group, Year))) +