Skip to content
Back to formatted view

Raw Message

Message-ID: <58A1E404.1080404@sapo.pt>
Date: 2017-02-13T16:51:16Z
From: Rui Barradas
Subject: How to output "0" after paste() ?
In-Reply-To: <15a384d44fa.d1a0eb272791.4415673583821893624@zoho.com>

Hello,

See the help page for ?sprintf.

sprintf("why no dot zero %1.1f after init", aa)

Hope this helps,

Rui Barradas

Em 13-02-2017 16:27, vod vos escreveu:
> Hi everyone,
>
>
>
> How to get "0" after init?
>
>
>
> aa&lt;- seq(2,7,0.5)
>
>
>
> aa
>
>
>
> [1] 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0
>
>
>
> bb&lt;- paste("why no dot zero",aa,"after init",sep="")
>
>
>
> bb
>
>
>
> the output are:
>
>
>
> [1] "why no dot zero2after init"   "why no dot zero2.5after init"
>
> [3] "why no dot zero3after init"   "why no dot zero3.5after init"
>
> [5] "why no dot zero4after init"   "why no dot zero4.5after init"
>
> [7] "why no dot zero5after init"   "why no dot zero5.5after init"
>
>   [9] "why no dot zero6after init"   "why no dot zero6.5after init"
>
> [11] "why no dot zero7after init"
>
>
>
> What I want are like: "why no dot zero2.0after init"  ,"why no dot zero3.0after init"
>
>
>
> I used round(), signif(), but it does not help. Any ideas?
>
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
>