Re: [R] About concatenating strings

2017-01-05 Thread Jim Lemon
Hi lily, maybe this is what you want: strings1<-c(1.2,1.31,1.4,1.51) strings2<-c(2.1,2.22,2.3,2.44) paste(formatC(strings1,digits=2,format="f"), formatC(strings2,digits=2,format="f"),sep="-") Jim On Fri, Jan 6, 2017 at 4:56 PM, lily li wrote: > Sorry for the emails. I

Re: [R] About concatenating strings

2017-01-05 Thread lily li
Sorry for the emails. I just checked and the problem is still there. Is there a proper way to reformat the decimal places, such as three or four decimal places? Thanks. If maintain four decimal places, the numbers are: 1.2000, 1.3100, 1.4000, etc. On Thu, Jan 5, 2017 at 10:46 PM, lily li

Re: [R] About concatenating strings

2017-01-05 Thread lily li
I found that the last column is the digits 2.00, so the problem is solved. On Thu, Jan 5, 2017 at 10:42 PM, lily li wrote: > Hi R users, > > I'm trying to concatenate two strings, while each string has numbers. > For example, strings1 = c(1.2, 1.31, 1.4, 1.51, etc),

[R] About concatenating strings

2017-01-05 Thread lily li
Hi R users, I'm trying to concatenate two strings, while each string has numbers. For example, strings1 = c(1.2, 1.31, 1.4, 1.51, etc), strings2= c(2.1, 2.22, 2.3, 2.44, etc). I want to have all decimals for the two strings, such as: strings1= c(1.20, 1.31, 1.40, 1.51, etc), string2 = c(2.10,