Looking at the help file and code for dput does not show any simple
way to do what you want. But the help page makes reference to the
deparse function and deparse does have a width.cutoff argument. So
you could use deparse instead of dput (the use cat or other functions
to display the results similar to dput). A quick example (though
going the opposite direction):
> cat(deparse(1:30*2, width.cutoff=20),'\n\n',sep='\n')
c(2, 4, 6, 8, 10, 12,
14, 16, 18, 20, 22, 24,
26, 28, 30, 32, 34, 36,
38, 40, 42, 44, 46, 48,
50, 52, 54, 56, 58, 60
)
On Tue, May 27, 2014 at 9:15 AM, Stavros Macrakis (??????? ????????)
<macrakis at alum.mit.edu> wrote:> Is there some way to control the line width that dput uses?
> options(width=...) does not affect dput.
>
> For example, currently
>
>> dput(1:30*2)
> c(2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, *line break
> here*
> 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60)
>
> but on a wider display, I'd like to have no line break.
>
>
> Tested on R version 3.1.0 (2014-04-10) x86_64-apple-darwin13.1.0 (64-bit)
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
--
Gregory (Greg) L. Snow Ph.D.
538280 at gmail.com