Simple, but was taking me a long time to google.
Thanks Phil, happy Thanksgiving.
--
View this message in context:
http://r.789695.n4.nabble.com/Create-new-string-of-same-length-as-entry-in-dataframe-tp3058232p3058275.html
Sent from the R help mailing list archive at Nabble.com.
Suppose you want to replace using all b's:
thestring = 'bb'
t2$V3 = substring(thestring,1,t2$V2)
t2$V3
[1] "bbb""" "bb" "b" "bb"
For the second case,
thestring = paste(rep('bad',5),collapse='')
thestring
[1] "badbadbadbadbad"
t2$V3 = substring(the
I suspect that this is simple, but thanks in advance for any advice...
I have a dataframe, t2:
V1 V2
aaa 3
4
aa6
a1
aa 2
V2 is the length of the string in V1 using nchar(as.character(t1$V1))
I'd like to create a third column, that cont
3 matches
Mail list logo