
The easiest way to deal with this would have been to use the read_csv function from the readr package instead of read.csv. Notice that mapply requires the function come first and then the arguments.ĭat2DF <- dplyr::bind_rows(dat2. In this case we have two arguments: the Closing price and the stock name. The “m” in mapply means “multiple arguments”. Next we set up one row of three plotting regions. First we create a vector of stock names for plot labeling. We can do this with the base R function mapply. In this case we may want to plot Closing price for each stock and look for trends.
#HOW TO INSTALL PACKAGE IN R FROM ZIP FILE CODE#
The following R code will download and unzip the data in your current working directory if you wish to follow along. We visited Yahoo Finance on 13 April 2017 and downloaded about three weeks of historical data for three companies: Boeing, Johnson & Johnson and IBM. We use some real world data and replicate what purrr does in base R so we have a better understanding of what’s going on. The purpose of this article is to provide a short introduction to purrr, focusing on just a handful of functions. We think this is the most thorough and extensive introduction to the purrr package currently available (at least at the time of this writing.) Wickham is one of the authors of the purrr package and he spends a good deal of the chapter clearly explaining how it works. If you’re wondering what exactly the purrr package does, then this blog post is for you.īefore we get started, we should mention the Iteration chapter in R for Data Science by Garrett Grolemund and Hadley Wickham.
