The purpose of the plyr and dplyr libraries in R is to manipulate data with ease. As we’ve seen in a previous post, there are various methods of wrangling and summarising data in R. However, wouldn’t it be great if […]
Continue reading »Category: R
tidytext: Word Clouds and Sentiment Analysis in R
The tidytext library in R is one of the most innovative I’ve come across within the language. tidytext is the cornerstone library for developing text mining algorithms in R (developed by Julia Silge and David Robinson). Here, I conduct a […]
Continue reading »kNN: K-Nearest Neighbours Algorithm in R and Python
The purpose of a k-nearest neighbours algorithm (kNN) is to classify information. kNN is one of the most simplistic machine learning algorithms, and is very useful when it comes to solving classification problems. kNN: R Let’s start off by examining […]
Continue reading »Create PostgreSQL Database In Linux And Connect To R – Part I
PostgreSQL is a commonly used database language for creating and managing large amounts of data effectively. Here, you will see how to: 1) create a PostgreSQL database using the Linux terminal 2) connect the PostgreSQL database to R using the […]
Continue reading »Creating functions and using lapply in R
Functions are used to simplify a series of calculations. For instance, let us suppose that there exists an array of numbers which we wish to add to another variable. Instead of carrying out separate calculations for each number in the […]
Continue reading »Poisson and Cumulative Binomial Probabilities
A Poisson Distribution is a probability distribution which calculates the probability of a set of independent occurrences within a fixed time or space. e.g. Let us suppose that a prestigious college receives 1000 applications in a particular time interval. On […]
Continue reading »Creating maps in R using ggplot2 and maps libraries
Here is how we can use the maps, mapdata and ggplot2 libraries to create maps in R. In this particular example, we’re going to create a world map showing the points of Beijing and Shanghai, both cities in China. For […]
Continue reading »Variance-Covariance Matrix in R (corpcor, covmat)
The following tutorial demonstrates how to calculate a variance-covariance matrix in R, along with shrinkage estimate of covariance and the calculation of a covariance into a correlation matrix. The purpose of a variance-covariance matrix is to illustrate the variance of […]
Continue reading »Linear Models in R: OLS and Logistic Regressions
We use linear models primarily to analyse cross-sectional data; i.e. data collected at one specific point in time across several observations. We can also use such models with time series data, but need to be cautious of issues such as […]
Continue reading »Cross-Correlation Function In R (ccf)
When working with a time series, one important thing we wish to determine is whether one series “causes” changes in another. In other words, is there a strong correlation between a time series and another given a number of lags? […]
Continue reading »