[R] Working with string

Christofer Bogaso
Thu, 14 Mar 2013 14:42:43 -0000

Hello again,

Let say I have following string:

Vec <- c("sada", "asdsa", "sa")

Now I want to make each element of this vector with equal length.
Basically I want following vector:

c("sada ", "asdsa", "sa   ")

Therefore we can get:

> nchar(c("sada ", "asdsa", "sa   "))
[1] 5 5 5


Is there any possiblity that we can do it programetically? Because I
need to handle a really big vector.

Thanks for your help.