Hi,

Could anybody please help me with this? In the following function, I try to
return a good format of x, i.e. if my x[1] is 800, I don't want it to give
me 800.0.
I tried format(x, trim = TRUE), but didn't work.
If my x has only first three components, which are all integers, I don't run
into this problem. So I guess fractional numbers cause this problem.
The comment line works, but I wondering if there are better ways of doing
this.
Thank you.

problem1<-function(){
 x <- round(runif(1,0.5,9.5))*100;
 if (x<=500){
    x<-c(x,x+50+round(runif(1,0.5,19.5))*5,x+50+round(runif(1,0.5,19.5))*5,
          round(runif(1,0.5,4.5))+0.5, round(runif(1,4,9),1));}
 else{

x<-c(x,x+100+round(runif(1,0.5,19.5))*5,x+100+round(runif(1,0.5,19.5))*5,
          round(runif(1,0.5,4.5))+0.5, round(runif(1,4,9),1));}

c(format(x))
 # c(format(x[1]),format(x[2]),format(x[3]))
}

Best,
Zhongyi

	[[alternative HTML version deleted]]

