learn R wisdom with fortunes

[This article was first published on YGC » R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

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 about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

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)