Hi Baojun,
You probably need the right condition:
x<-c(1,2,3.1415926535,4)> nonint<-floor(x)!=x
> nonint
[1] FALSE FALSE TRUE FALSE> x[nonint]<-round(x[nonint],3)
> x
[1] 1.000 2.000 3.142 4.000
Jim
On Fri, Nov 8, 2019 at 12:54 AM Baojun Sun <bsun1 at students.towson.edu>
wrote:>
> I have a Excel spreadsheet with two kinds of elements: these include
> non-integers and integers. I want to select all numbers with decimal points
> i.e. 3.1415 (non-integers). I don't want to highlight cells that are
whole
> numbers like 314. How do I do this custom selection? My goal is to make all
> non-integers fixed to 3 decimal places and keep all whole numbers as they
> are.
>
> I've tried conditional formatting.
>
> Is there any way I can do this in a programming language like R's
dplyr?
>
>
> Thanks.
>
> [[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.