Quantcast
Channel: R HEAD » Custom Function
Browsing index pages (4 articles)

Image may be NSFW.
Clik here to view.

A handy concatenation operator

It may be useful for you to define a concatenation operator for characters. Sometimes, I find this is more intuitive and handy than using paste0 or paste. Also, it makes your code look better when you...

View Article


Image may be NSFW.
Clik here to view.

Generating a lag/lead variables

A few days ago, my friend asked me is there any function in R to generate lag/lead variables in a data.frame or did similar thing as _n in stata. He would like to use that to clean-up his dataset in R....

View Article


Image may be NSFW.
Clik here to view.

A shortcut function for install.packages() and library()

I enjoy trying difference kind of R packages. Since I have more than 1 computers (1 at home, 1 at office and a laptop) it is troublesome to check whether I have installed some new packages for each...

View Article

Image may be NSFW.
Clik here to view.

A quick way to do row repeat and col repeat (rep.row, rep.col)

Today I worked on a simulation program which require me to create a matrix by repeating the vector n times (both by row and by col). Even the task is extremely simple and only take 1 line to...

View Article
Browsing index pages (4 articles)


Latest Images