# One R Function A Day.

February 11, 2013
By

(This article was first published on Category: R | Huidong Tian's Blog, and kindly contributed to R-bloggers)

As a R user with 5 years experience, I still have some basic functions that never used or never thought they could exist. Many times I was suprised with some elegant R functions, such like strwidth, parent.frame, etc. No one can know all R functions (and it’s unnecessary), but it’s very convenient to know some basic functions, especially those in the basic packages: base, utils, stats, etc.

I used to have a learning plan: learn one R function a day. But it was terminated because I always fail to remember it. Today, once again I found a useful function of the basic package base, which impelled me to keep learning R as a daily work. How could one guy who said he has 5 years experience but still doesn’t know some basic functions?!

My plan is simple: everyday I log on my computer, one of the first tasks is reading one topic-help document. To avoid forgetting to do this, I need the help page appears automatically.

So, I need to build a topic list first, and I want to start with the base package. The following is my code:

Then I need to choose an order to load the topic one by one. The function parent.frame(2)\$ofile is used to get current script’s absolute path.

The last step is creating a .bat file to run the R code in a batch mode, and add that file to your Task Scheduler and set the trigger as “at log on”. The content of the .bat file looks like this:

Any kind of criticism or commet are welcome!