This is probably simple in R, but I cannot find a working solution. I have a list of numbers, i.e. c(1,2,3,4) and I want to get one single string " 1 2 3 4" where every number (can be float) have a fixed width.
> dput(l)
c(1, 1.5, 2, 2.5)
> paste(l)
[1] "1" "1.5" "2" "2.5"
> paste(as.character(l))
[1] "1" "1.5" "2" "2.5"
> str_pad(l,width=7,side="left")
[1] " 1" " 1.5" " 2" " 2.5"
> paste(str_pad(l,width=7,side="left"))
[1] " 1" " 1.5" " 2" " 2.5"
And many other tries, nothing work. I need result in the variable not just on the screen.