Publications by Kun Ren

A brief introduction to higher order functions in R

14.03.2014

In R, function may not be as special as it is in other programming languages; it is regarded as one of the many types and can be passed as an argument to some other function. The way we deal with other objects such list and data.frame definitely applies to function. Here is a simple example in which we define two functions and pass them to anothe...

6035 sym R (434 sym/7 pcs)

Fit an Ornstein–Uhlenbeck process with discrete time series data

04.04.2014

As we know, a Brownian motion is usually formulated as $$dx_t = mu,dt+sigma,dW_t$$ which is the continuous case of a random walk. In some cases, it is quite convenient to use this formulation to describe the characteristic of asset prices due to its highly unpredictable behavior. However, there are financial indicators or variables that also exhi...

3622 sym R (489 sym/3 pcs)

Use pipeline operators in R

07.04.2014

In data-driven statistical computing and data analysis, applying a chain of commands step by step is a common situation. However, it is neither straightforward nor flexible to write a group of deeply nested functions. It is because the function that comes later must be written first. Consider the following example in which we need to take the fo...

6185 sym R (1018 sym/5 pcs)

A new gitbook – learnR

30.05.2014

Gitbook is rather a relatively new concept on the web. It provides a user-friendly framework for authors to write and produce online books with beautiful illustrations and responsive interactions. It allows authors to write in Markdown syntax, which is very easy to learn and use, so that they can focus more on the contents they try to produce tha...

2885 sym

rlist: a new package for working with list objects in R

25.06.2014

In recent years, non-relational data have attracted more and more attentions. Roughly speaking, all datasets that are hard to put into a rectangular table with rows and columns are non-relational datasets. The following data is a very simple non-relational dataset in JSON format. The dataset contains some information of three programmers, each of...

3877 sym R (4516 sym/14 pcs)

What are the most popular keywords of CRAN packages?

24.07.2014

(This article is adapted to the latest version of rvest package.) A large proportion of R's power should be attributed to the enormous amount of extension packages. Many packages are published to CRAN. These packages cover a wide range of fields. In this post, I'll show you how to use R to scrap the titles of all CRAN packages from the web page a...

1786 sym R (3961 sym/3 pcs)

Scraping information of CRAN packages

28.07.2014

(This article is adapted to the latest version of rvest package.) In my previous post, I demonstrated how we can scrape online data using existing packages. In this post, I will take it a bit further: I will scrape more information of CRAN packages since each of them also has a web page like this. More specifically, I want to build my own databa...

2640 sym R (4165 sym/3 pcs)

Introducing pipeR 0.4

03.08.2014

pipeR 0.4 is released! Check it out at the project page. In this new version, two things happen. First, %>>% handles everything. Second, the introduction of Pipe object. %>>% In version 0.4, I decide to merge the functionality of all three operators in the previous versions. Only %>>% operator remains, and the two other operators are deprecated. ...

3723 sym R (606 sym/6 pcs)

Introducing rlist 0.3

05.08.2014

rlist 0.3 is released! This package now provides a wide range of functions for dealing with list objects. It can be especially useful when they are used to store non-tabular data. Two notable features are added in this version. First, list.search and equal() are added in support of fuzzy filtering and searching. Second, List object is added to pr...

4615 sym R (2590 sym/11 pcs)

A quiz on magrittr: How many scores can you get?

06.08.2014

Here is a quiz on magrittr and you may check if you are really good at using it. Since the CRAN version currently does not support nested ., it won't be interesting to make a quiz on that version. All the following examples are using the latest development version on GitHub. You can do the same test with the CRAN version if you like. Consider the...

2635 sym R (2430 sym/11 pcs)