How do I print text strings to a given length, ie, if they are too long I want them truncated (from the end)?> format.char("123", width = 1)does not do what I want, ie, "1". --- G?ran Brostr?m tel: +46 90 786 5223 Department of Statistics fax: +46 90 786 6614 Ume? University http://www.stat.umu.se/egna/gb/ SE-90187 Ume?, Sweden e-mail: gb at stat.umu.se
On Wed, 21 May 2003, G?ran Brostr?m wrote:> How do I print text strings to a given length, ie, if they are too long > I want them truncated (from the end)? > > > format.char("123", width = 1)?substr substr("123", 1, 1)> > does not do what I want, ie, "1". > > --- > G?ran Brostr?m tel: +46 90 786 5223 > Department of Statistics fax: +46 90 786 6614 > Ume? University http://www.stat.umu.se/egna/gb/ > SE-90187 Ume?, Sweden e-mail: gb at stat.umu.se > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help >-- Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Breiviksveien 40, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93 e-mail: Roger.Bivand at nhh.no
G?ran Brostr?m wrote:> How do I print text strings to a given length, ie, if they are too long > I want them truncated (from the end)? > > >>format.char("123", width = 1) > > > does not do what I want, ie, "1". > > --- > G?ran Brostr?m tel: +46 90 786 5223 > Department of Statistics fax: +46 90 786 6614 > Ume? University http://www.stat.umu.se/egna/gb/ > SE-90187 Ume?, Sweden e-mail: gb at stat.umu.se > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-helpSee ?substring Uwe Ligges
On Wed, 21 May 2003, Uwe Ligges wrote:> G?ran Brostr?m wrote: > > How do I print text strings to a given length, ie, if they are too long > > I want them truncated (from the end)? > > > > > >>format.char("123", width = 1) > > > > > > does not do what I want, ie, "1". > > > > --- > > G?ran Brostr?m tel: +46 90 786 5223 > > Department of Statistics fax: +46 90 786 6614 > > Ume? University http://www.stat.umu.se/egna/gb/ > > SE-90187 Ume?, Sweden e-mail: gb at stat.umu.se > > > > ______________________________________________ > > R-help at stat.math.ethz.ch mailing list > > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > > > See ?substringOh yes, thanks to all who responded! G?ran