From ggrothendieck at gmail.com  Wed Apr  7 13:33:18 2010
From: ggrothendieck at gmail.com (Gabor Grothendieck)
Date: Wed, 7 Apr 2010 07:33:18 -0400
Subject: [Rd] Additions to posting guide
In-Reply-To: <m2r971536df1004070431q7b650fccu6618ce4167e8cbd5@mail.gmail.com>
References: <m2r971536df1004070431q7b650fccu6618ce4167e8cbd5@mail.gmail.com>
Message-ID: <u2p971536df1004070433y11e0166ar9cb7f7f949bf6d5a@mail.gmail.com>

e-letter, who had suggested that something about textConnection be
added, also suggested that warning against posting code that first
wipes out all variables in the workspace.

On Wed, Apr 7, 2010 at 7:31 AM, Gabor Grothendieck
<ggrothendieck at gmail.com> wrote:
> 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.
>



[Rd] Additions to posting guide
Gabor Grothendieck