[R] Simple cat statement - output truncated

Stavros Macrakis macrakis at alum.mit.edu
Thu Jul 16 16:38:48 CEST 2009


Kevin,

The habitués of this mailing list get irritated when users mail in
problem reports which don't include enough information to reproduce
the problem, as requested in the standard footer of r-help mail
("PLEASE ... provide commented, minimal, self-contained, reproducible
code.") This irritation is sometimes expressed aggressively and
sometimes humorously. Be thankful that you drew "humorously".

So... please provide minimal, self-contained code that allows us to
reproduce your problem.  What is meant by "self-contained"?  It is
code that if you type it in to a fresh R, elicits your problem.  This
includes setting any necessary variables to appropriate values etc.

            -s

On Thu, Jul 16, 2009 at 10:21 AM, <rkevinburton at charter.net> wrote:
>
> So then I am to assume that the output of 'cat' can be truncated by passing it "bad" arrays. That is the only difference between the "reproducible" code you show and mine. It is just a theory but say that the components array is not dimmensioned for 4 elements. It seems a little strange if that is the case that a reference error is not thrown and just the output of the cat call is affected.
>
> Kevin
>
> ---- Duncan Murdoch <murdoch at stats.uwo.ca> wrote:
> > On 7/15/2009 9:53 AM, rkevinburton at charter.net wrote:
> > > I have a statement:
> > >
> > >     cat("myforecast ETS(", paste(object$components[1], object$components[2], object$components[3], object$components[4], sep = ","), ") ", n, "\n")
> > >
> > > That generates:
> > >
> > > cast ETS( A,N,N,FALSE )  3
> > >
> > > Anyone guess as to why the first 5 letters are truncated/missing?
> >
> > You are probably being punished for posting non-reproducible code*.
> >
> > When I try a reproducible version of the line above, things look fine:
> >
> >  > cat("myforecast ETS(", paste("A","N","N",FALSE, sep = ","), ") ", 3,
> > "\n")
> > myforecast ETS( A,N,N,FALSE )  3
> >
> >
> > Duncan Murdoch
> >
> > * R has a new predictive punishment module.  It punishes you for things
> > it knows you will do later.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list