[Rd] Additions to posting guide

Gabor Grothendieck ggrothendieck at gmail.com
Wed Apr 7 13:31:26 CEST 2010


One user said he would have found it useful to have textConnection be
described in the posting guide since he was having problems creating a
self-contained post.

I suggest the following section be added:


How to post "commented, minimal, self-contained, reproducible code"
===================================================================

The footer of every message to r-help reminds the poster that postings
should include "commented, minimal, self-contained, reproducible code".

That means that

- responders can copy the code to the clipboard without further modification
  and paste it into their session to reproduce it.

- the data must be included and

- the data should be cut down to the smallest amount that will illustrate
  the problem.


To include the data:

- use dput(mydata).  That will output R source code whose value is the
  indicated data and you can then write:

	mydata <-

  where you place the output of dput to the right of the arrow.

- use textConnection.  An alternative in the case of data frames is to
  read in a text string like this:

  Lines <- "A,B,C
  1,2,x
  3,4,y"
  DF <- read.table(textConnection(Lines), header = TRUE)

  Using textConnection(Lines) in place of a file name causes the input to
  be taken from the indicated string and facilitates self-contained posts.



More information about the R-devel mailing list