'How to paste data without adding spaces in R

I am attempting to add two pieces of data into one column, where one of the pieces of data is surrounded by parentheses, but whenever I attempt it in R, there is an extra space between the number added within parentheses and the final parentheses. Here is some example code:

#Pull in library:

library(dplyr)

#Use DNase data as example:

data_1 <- DNase

#Attempt to paste new column:

data_1$pasted <- paste(data_1$conc, data_1$density, sep = " (") %>% paste(")")

Examine data: 


print(data_1)

The top few rows of this print end up looking like this :

Grouped Data: density ~ conc | Run
    Run        conc density              pasted
1     1  0.04882812   0.017 0.04882812 (0.017 )
2     1  0.04882812   0.018 0.04882812 (0.018 )
3     1  0.19531250   0.121  0.1953125 (0.121 )
4     1  0.19531250   0.124  0.1953125 (0.124 )
5     1  0.39062500   0.206   0.390625 (0.206 )


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source