I underestimated the popularity of wordcloud plots for non-data science individuals, such as my kids, who are eager to impress their elementary school teachers with wordcloud-embedded assignments. That is the motivation for this super short Medium article. I haven’t written anything new in a month. I have been busying with teaching as my big data and marketing analytics (BDMA) course for laurier’s MMA students will end in two weeks.

In just ten lines (counted by RStudio script line index), I show how to create a wordcloud from your chosen “raw” text. The only thing that needs from you is to…

We frequently encounter datasets with missing values (represented as NAs in the data frame). Missing values render useless some part of the data. Why those values are missing is a different story and is beyond the scope of this article. Here we only talk about treatment.

The primary treatment is either to delete the rows with missing values (reducing the No. of observations) or to remove the columns with missing values (giving up some information). Some people are not happy with a reduced dataset, and they replace missing values with summary stats such as means or medians of available values…

You may hear people talking about wide and long type data. What is wide type data? Here is an example of the investment portfolio of five individuals. The first column records individual IDs (1 to 5), and the rest record the amount invested in the three types of assets: stock.market, mutual.fund, and bank.deposit by each individual.

Photo by Aron Visuals on Unsplash

In this short article, I summarize different techniques in data import to R. A spectrum of approaches that trade-off speed vs convenience is presented for my readers to choose from.

Assuming the data files are all stored on Folder F:\BDMA\data\. The most user-friendly data import approach is an interactive method; that is, it allows you to open folders to locate the data file like a regular file-open operation. Make sure you notice a flashing window on the taskbar that invites you to choose the destination file.

df.name=read.csv(file.choose())

Another you-import-what-you-see approach is through copy & paste.

Suppose you want ‘directly’ copy…

I have introduced pipe operations in Part 1. I will walk through the other powerful weapon in R programming: functions. The idea is that, anything you expect to do multiple times, you shall consider using functions, e.g., to run multiple multiple regressions, or to make a series of similar plots. With pipe operations embedded within functions, you really take full advantage of R programming.

Let's begin with a simple example. Suppose you are given a small arithmetic homework by your kid to find out the sum of squares of all the integers between a given number, say 4, and 100…

Yes, that’s correct. R beginners can quickly upgrade their R programming capabilities by mastering two things: pipe operations (%>%) and write-your-own functions, for plotting, data wrangling, regression results extraction, and many more.

Suppose you just started to learn how to empower R for your work-like some of my MBA students who heard of MSE for the first from me, and now you are happy for writing code in R-Studio that work, e.g., run a logistic regression-based classification. In that case, it is time to accelerate your R coding skills. I mean to do the same job with easier, shorter, clearer…

R users still use Excel, particularly when working with people who solely rely on Excel. The task to share analytical results generated by R to Excel is frequent in many organizations. Hence, a convenient and versatile passage between R and Excel is highly desirable. Here is how to establish such a passage.

Although R allows exporting results to csv format, which Excel can open, several major challenges remain. First, you can insert only one sheet to a csv file, no more. Second, all non-standard characters (e.g., Chinese or Japanese) are not displayed properly because csv files cannot deal with Unicode/UTF-8…

Martinqiu

I a marketing professor and I teach BDMA (big data and marketing analytics) at Lazaridis School of Business, Wilfrid Laurier University, in Waterloo, Canada.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store