learn R wisdom with fortunes

January 5, 2015
By

(This article was first published on YGC » R, and kindly contributed to R-bloggers)

I like running fortune every time when the terminal was started. A screenshot is shown below:

wmaker

At the end of the post trick things in R, I introduced the fortunes package of R.

The fortune program provides UNIX related quotations, while the quotations supplied by the R package, fortunes, are all R related. We can learn a lot from these quotations.

> fortune(343)
Sooner or later most R beginners are bitten by this all too convenient
shortcut. As an R newbie, think of R as your bank account: overuse of
$-extraction can lead to undesirable consequences. It's best to acquire the
'[[' and '[' habit early.
   -- Peter Ehlers (about the use of $-extraction)
      R-help (March 2013)

I have answered why ‘[[‘ and ‘[‘ is better than ‘$’ in the post, tricky things in R. One more thing I want to emphasize is that we should remember that ‘[[‘ and ‘[‘ are all functions that defined in the base package. Their behaviour is predictable when applying to data.frame or list. But when they were applicable to S4 object, they don’t always work in the way you expected. You should read the documents of how they were defined. Don’t try to guess by your intuition. This is also a reason of why R is hard to learn.

> fortune(343)
'They' did write documentation that told you that Perl was needed, but 'they'
can't read it for you.
   -- Brian D. Ripley
      R-help (February 2001)

In this post, I would like to introduce how to print a random quotation when every time R is started. It’s very easy, just add the following lines to ~/.Rprofile

?View Code RSPLUS
1
2
library("fortunes")
fortune()

2014-12-16-210302_636x506_scrot

Robin Hankin: I'd say that without a tool like R you cannot learn statistics.
David Whiting: I believe Fisher and a few others managed to get by without it.
Peter Dalgaard: But think how far they could have got with R!
   -- Robin Hankin, David Whiting, and Peter Dalgaard (on teaching/learning
      statistics with R)
      R-help (December 2004)

Learn statistics with R is almost unavoidable especially for students in biology. AND learn R wisdom with fortunes, it can be fun.

2014-11-25-132948_552x414_scrot

Related Posts

To leave a comment for the author, please follow the link and comment on their blog: YGC » R.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Sponsors

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)