concatenate three variable values into single value in r -


i have 3 variables. intention concatenate 3 variables 1 variable have used cat function concatenate 3 variables displaying values correctly,but i'm getting spaces in between values. here don't want spaces in between values while making concatenation.

a little more concise @duna's suggestion following:

## @duna's sample data dd = data.frame(x = letters[1:5], y = 1:5,                  z = c("this", "could", "work", "for", "you!"))  do.call(paste0, dd) # [1] "a1this"  "b2could" "c3work"  "d4for"   "e5you!"  

the following work:

do.call(paste, c(dd, sep = "")) with(dd, paste(x, y, z, sep = "")) with(dd, paste0(x, y, z)) 

and, variety:

with(dd, sprintf("%s%s%s", x, y, z)) 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -