"Most organizations early on in the data-science learning curve spend most of their time assembling data and not analyzing it. Mature data science organizations realize that in order to be successful they must enable their members to access and use all available data—not some of the data, not a subset, not a sample, but all data. A lawyer wouldn’t go to court with only some of the evidence to support their case—they would go with all appropriate evidence. ...The fundamental building block of a successful and mature data science capability is the ability to ask the right types of questions of the data. This is rooted in the understanding of how the business runs... The mature data science organization has a collaborative culture in which the data science team works side by side with the business to solve critical problems using data. ... [it] includes one or more people with the skills of a data artist and a data storyteller. Stories and visualizations are where we make connections between facts. They enable the listener to understand better the context (What?), the why (So what?), and “what will work” in the future (Now what?)."
|--Peter Guerra and Kirk Borne in Ten Signs of Data Science Maturity (2016)
Guerra and Borne (2016) highlight the importance of a diverse and inquisitive team approach to data science. Business intelligence also benefits from this approach. Introduction to R for Business Intelligence gives you a way to explore the world of business intelligence through the eyes of an analyst working in a successful and growing startup company. You will learn R through use cases supporting different business functions.
This book provides data-driven and analytically focused approaches to help you answer business questions in operations, marketing, and finance—a diverse perspective. You will also see how asking the right type of questions and developing the stories and visualizations helps you connect the dots between the data and the business.
Enjoy the journey as you code solutions to business intelligence problems using R.
This book is written in three parts that represent a natural flow in the data science process: data preparation, analysis, and presentation of results.
In Part 1, you will learn about extracting data from different sources and cleaning that data.
Chapter 1, Extract, Transform, and Load, begins your journey with the ETL process by extracting data from multiple sources, transforming the data to fit analysis plans, and loading the transformed data into business systems for analysis.
Chapter 2, Data Cleaning, leads you through a four-step cleaning process applicable to many types of datasets. You will learn how to summarize, fix, convert, and adapt data in preparation for your analysis process.
In Part 2, you will look at data exploration, predictive models, and cluster analysis for business intelligence, as well as how to forecast time series data.
Chapter 3, Exploratory Data Analysis, continues the adventure by exploring an unfamiliar dataset using a structured approach. This will provide you insights about features important for shaping further analysis.
Chapter 4, Linear Regression for Business, (co-authored with Rick Jones) walks you through a classic predictive analysis approach for single and multiple features. It also reinforces key assumptions the data should meet in order to use this analytic technique.
Chapter 5, Data Mining with Cluster Analysis, presents two methods of unsupervised learning with examples using k-means and hierarchical clustering. These two data mining techniques allow you to unearth patterns hidden in the data.
Chapter 6, Time Series Analysis, introduces a difficult topic not often taught in data science courses. You will explore non-machine learning methods to forecast future values with data that are dependent on past observations.
Finally, in Part 3 you will learn to communicate results with sharp visualizations and interactive, web-based dashboards.
Chapter 7, Visualizing the Data’s Story, explores more than just techniques to interactively visualize your results. You will learn how your audience cognitively interprets data through color, shape, and position.
Chapter 8, Web Dashboards with Shiny, (authored by Steven Mortimer) culminates your adventure by explaining how to create a web-based, business intelligence application using R Shiny.
There are a number of appendices providing additional information and code.
Appendix A, References, provides a list of the references used throughout the book.
Appendix B, Other Helpful R Functions, provides a list of functions and their descriptions. These are useful in data science projects and this appendix allows you to explore how they may help you work with data.
Appendix C, R Packages Used in the Book, gives a complete list of all the R packages used in each chapter. This allows you to install all the packages you will need by referring to a single list. It also contains instructions on installing packages.
After completing the use cases, you will be able to work with business data in the R programming environment and realize how data science helps make informed decisions when developing business strategy. Along the way, you will find helpful tips about R and business intelligence.
You need the R statistical package, available free as an open source download from CRAN (https://www.r-project.org/). This book used R version 3.3.1 for Windows. You will get the same results using the macOS or Linux software.
Optionally, it is also recommended that you use RStudio Desktop, an open source user interface that works with R (https://www.rstudio.com/). This book used version 0.99.903 for Windows. It is also available for macOS and Linux.
Lastly, you will need to install a variety of R packages to perform the various analyses. All these are all freely available using the
install.packages() function within R. You can get a refresher on installing packages in Appendix C, R Packages Used in the Book.
This book provides code using the R statistical programming language. Perhaps it has been a while since you last used or learned R. If that is the case, then you may find the following material quite useful. It provides a listing of R skills that you should know before working on the use cases provided in each of the chapters.
Video links (Peng, 2015; Peng, 2014; LawrenceStats, 2016; Peng, 2012) for each skill provide an explanation of techniques that you may want to review before continuing:
Installing R Studio
Windows and macOS: https://www.youtube.com/watch?v=bM7Sfz-LADM;feature=youtu.be;t=10s
Installing R packages
Setting working directory
Control structures (part 1): https://www.youtube.com/watch?v=8RmwEBo8yy0
Control structures (part 2): https://www.youtube.com/watch?v=z8V-a6d8JTg
Base plotting (part 1): https://www.youtube.com/watch?v=AAXh0egb5WM
Base plotting (part 2): https://www.youtube.com/watch?v=bhyb1gCeAVk
Subsetting basics: https://www.youtube.com/watch?v=VfZUZGUgHqg
Subsetting matrices: https://www.youtube.com/watch?v=FzjXesh9tRw
This book is for business analysts who want to increase their skills in R and learn analytic approaches to business problems. Data science professionals will benefit from this book as they apply their R skills to business problems and learn the language of business.
In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.
Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "You can load the Bike Sharing data file into the R environment by using the
A block of code is set as follows:
bike$holiday <- factor(bike$holiday, levels = c(0, 1), labels = c("no", "yes")) bike$workingday <- factor(bike$workingday, levels = c(0, 1), labels = c("no", "yes"))
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
query <- "SELECT * FROM marketing" bike <- sqlQuery(connection, query) close(connection)
Any command-line input or output is written as follows:
New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "RStudio will automatically create a
server.R file, if you create a new project and choose New Directory and Shiny Web Application as the type."
Feedback from our readers is always welcome. Let us know what you think about this book-what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of. To send us general feedback, simply e-mail [email protected], and mention the book's title in the subject of your message. If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
You can download the example code files for this book from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.
You can download the code files by following these steps:
Log in or register to our website using your e-mail address and password.
Hover the mouse pointer on the SUPPORT tab at the top.
Click on Code Downloads & Errata.
Enter the name of the book in the Search box.
Select the book for which you're looking to download the code files.
Choose from the drop-down menu where you purchased this book from.
Click on Code Download.
Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:
WinRAR / 7-Zip for Windows
Zipeg / iZip / UnRarX for Mac
7-Zip / PeaZip for Linux
The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Introduction-To-R-For-Business-Intelligence. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!
We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from https://www.packtpub.com/sites/default/files/downloads/IntroductionToRForBusinessIntelligence_ColorImages.pdf.
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books-maybe a mistake in the text or the code-we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.
To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.
Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at [email protected] with a link to the suspected pirated material.
We appreciate your help in protecting our authors and our ability to bring you valuable content.
If you have a problem with any aspect of this book, you can contact us at [email protected], and we will do our best to address the problem.