Jan 30, 2016 - Build A Blog in the R Way: Jekyll + Rmarkdown + RStudio

Thanks for Yihui Xie and his GitHub repo, I find a good way to write blog in Rmarkdwon, which could support dynamic documentation, and display code and result simutaniously, and the command is pretty simple in RStudio.

servr::jekyll()

Now, this blog is hosted by GitHub, which provide a free jekyll server for bloger.

My main editor switch from Atom to RStudio, which give me a more powerful computation and interactive environment.

Jan 27, 2016 - Reading Notebook with Advanced R by Hadley Wickham

the difference between closure and builtin

example:

f <- function(){}
typeof(f)
## [1] "closure"
# > "closure"
typeof(sum)
## [1] "builtin"
# > "builtin"

mode() is just a shadow of typeof()

To see if an object is a pure base type, i.e., it doesn’t also have S3, S4, or RC behaviour, check that is.object(x) returns FALSE.

Check Static Class by otype() and ftype()

In S3, methods belong to functions, called generic functions, or generics for short. S3 methods do not belong to objects or classes. This is different from most other programming languages, but is a legitimate OO style.

x = seq(10)
y = rep(1,10)
t = data.frame(x,y)
otype(x)
## Error in eval(expr, envir, enclos): could not find function "otype"
# > "base"
otype(t)
## Error in eval(expr, envir, enclos): could not find function "otype"
# > "S3"

ftype(sum)
## Error in eval(expr, envir, enclos): could not find function "ftype"
# > [1] "primitive" "generic"

ftype(mean)
## Error in eval(expr, envir, enclos): could not find function "ftype"
# > [1] "s3"      "generic"

methods("mean")
## [1] mean.Date     mean.default  mean.difftime mean.POSIXct 
## [5] mean.POSIXlt 
## see '?methods' for accessing help and source code
# > [1] mean.Date     mean.default  mean.difftime mean.POSIXct  mean.POSIXlt
foo <- structure(list(), class = "foo")
# 1. Pipe to first-argument of function
rnorm(100) %>>%
  plot
## Error in eval(expr, envir, enclos): could not find function "%>>%"
# 
# 2. Pipe to . in an expression
# 
rnorm(100) %>>%
  plot(col="red", main=length(.))
## Error in eval(expr, envir, enclos): could not find function "%>>%"
# pass left side result into right side point.

a[1, , drop = FALSE]

Jan 10, 2016 - Improve Your R Engine

Today, I am introducing a power tool to improve your R engine performance without changing any R code in lots of features, like parallel, pipeline operation, compatible with Rstudio. Revolution R Open executes a typical R benchmark 2.5 times faster than the standard R distribution and some functions, such as linear regression, run up to 20 times faster.

Here is the download link for Revolution R Open.

# Revolution R Open 3.2.2
# Default CRAN mirror snapshot taken on 2015-08-27
# The enhanced R distribution from Revolution Analytics
# Visit mran.revolutionanalytics.com/open for information
# about additional features.
# 
# Multithreaded BLAS/LAPACK libraries detected. Using 4 cores for math algorithms.