Hello All,
I've been using R for two years now and I am happy to say this is the
first time I could not find the answer to my problem in the R-help
archives. Here is the pending problem:
I want to be able to insert delimiters, say commas, into a string of
characters at uneven intervals such
This should work for you.
foo-c(haveaniceday)#my string of character
bar-c(4,1,4,3) # my vector of uneven intervals
my.function - function(foo, bar){
+ # construct a matrix with start/end character positions
+ start - head(cumsum(c(1, bar)), -1) # delete last one
+ sel -
Try this:
paste(read.fwf(textConnection(foo), bar, as.is = TRUE), collapse = ,)
[1] have,a,nice,day
On 6/18/07, Christopher Marcum [EMAIL PROTECTED] wrote:
Hello All,
I've been using R for two years now and I am happy to say this is the
first time I could not find the answer to my problem
On Mon, 2007-06-18 at 16:54 -0700, Christopher Marcum wrote:
Hello All,
I've been using R for two years now and I am happy to say this is the
first time I could not find the answer to my problem in the R-help
archives. Here is the pending problem:
I want to be able to insert delimiters,