Preface

This is my second book that is related to R; my first one is still under review for publication. Based on my experiences on reading many books and writing a book, I think from Preface readers should have answers to these questions: What is the book about? What are the features of the book? Who are the intended readers? How to read the book? What is the background of the author? So, let me answer these questions here.

This book includes 16 R tips, such as “how to explore a ‘new’ data set” (Chapter 3), “How to create contingency tables” (Chapter 7), “how to tally” (Chapter 8), “how to join two data tables” (Chapter 9), “how to plot data” (Chapter 10), “how to create a dynamic report” (Chapter 11), “how to learn Shiny” (Chapter 12), “how to check code efficiency” (Chapter 14), …. These are all very much practically useful for a data analyst in his/her daily work.

This book gives detailed examples and uses fake data. Indeed, these are two features of the book. You may ask: “Why fake data, does it sound bad?” I do not care if it sounds bad. The reasons for using fake data are: (a) Fake data make reader’s life easier, because they are easy to be understood and they serve the purpose for helping the reader quickly grasp the concepts and techniques. (b) Fake data make my writing easier – this is obvious.

The cover of this book shows office buildings, and this book is directly for those data analysts who work in buildings like these ones and are doing official statistics, e.g. data analysis and reporting. Indirectly, this book is also for the other data analysts; they may more or less get something useful from this book. The presumed level of R knowledge of the intended readers is beginner or advanced beginner.

How to read this book? My suggestion is that firstly read the description at the beginning of each chapter and then read the R code. By “read the R code”, I mean the reader can try to mentally understand the code and then run the code in R to check if you get the expected results.

I wrote this book in my spare time (a couple of hours after dinner on work days and weekends). I did this because during my work I had solved some specific problems and after dinner when I digest–not food but–the solutions that I got I often had an urge to generalise the solutions. This is why I wrote this book. I have written down the solutions for the future me and also want to share them with you.

Short biography: I was born in China and grew up there. I earned a Ph.D. in Mathematical Statistics from the University of Regina, Canada. To see my publications, here is the link to my Google Scholar web page. I used to be in academia and changed to government jobs since 2016.

Acknowledgements: I want to thank three ex-colleagues. Eric Wu was my buddy, and I thank him for answering my heaps of R questions. Peter Ellis works very hard even in after hours (http://ellisp.github.io/); he motivated me to work hard. James Hogan, thank you so much for your encouragement and help when I was in a difficult time, and I would never forget about the chocolates and cake.

Special thanks to those who created the great R packages; special thanks to RStudio Inc., from which R users all over the world have tremendously benefited.

License: This work by Lingyun Zhang is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License