R Coding

Installing R and RStudio

This a short tutorial for the incoming students of UTSA’s MS in Data Analytics program. I am going to assume that the reader has no knowledge of R and RStudio, the Integrated Development Environment (IDE), which we use to code. If you are a Mac user and you are comfortable with command line tools using Terminal, I suggest taking more systematic route for preparing your MacOS for R installation using Homebrew.

Syllabus for DA6233

Online Appendix

This post accompanies the article “Rejoinder to ‘Endogeneity bias in marketing research: Problem, causes and remedies’” in Industrial Marketing Management (IMM). We restate some sections of the main text for completeness in this document. Throughout we include R code to run the 2SLS estimations, create graphs, and generate the datasets. Model setting Before we start working on simulated data, let’s understand how much bias we expect if we use each of OLS, ZKHL, and 2SLS.

Speed comparison of rbind, bind_rows, and rbindlist

I often need to create a list consisting of several data frames. A simple example is when you read an Excel file with multiple worksheets. Rather than reading the sheets one at a time and row binding them as you go, it’s often faster to read all the sheets into a list as separate data frames and then row bind them all at once. Another example is when you are storing data frames as they are returned by a website such as Facebook.