Re: [R] paste adjacent elements matching string

2009-12-05 Thread Jill Hollenbach
ly it breaks the long string back up into individual > strings using strsplit. > > On Fri, Dec 4, 2009 at 8:42 PM, Jill Hollenbach > wrote: > >> Hi all, >> I would like to combine elements of a vector: >> >> vec <- c("astring", "b", &qu

[R] paste adjacent elements matching string

2009-12-04 Thread Jill Hollenbach
that contains "string" at the end, it is combined with the next element, so that I get this: > res [1] "astringb" "cstringd" "e" Any help is much appreciated, still learning. Many thanks, Jill

Re: [R] how to have 'match' ignore no-matches

2009-10-05 Thread Jill Hollenbach
is: >dfnew2 01:01 03:01 02:01 04:01 01:01 0502 thanks again, Jill Jill Hollenbach wrote: > > Hi all, > I think this is a very basic question, but I'm new to this so please bear > with me. > > I'm using match to translate elements of a data frame using a loo

[R] how to have 'match' ignore no-matches

2009-10-05 Thread Jill Hollenbach
how I can just ignore those cells, and return the original contents if no match is found in the lookup table. Many thanks in advance, this site has been extremely helpful for me so far, Jill Jill Hollenbach, PhD, MPH Assistant Staff Scientist Center for Genetics Children's Hospi

Re: [R] paste first row string onto every string in column

2009-08-12 Thread Jill Hollenbach
lapply() to loop over the columns. This is what Patrick > Connolly suggested, which is > > as.data.frame(lapply(df, function(x) paste(x[1], x[-1], sep = ""))) > > Note, though, that this will do it to all columns, so if you ever > happen to have a dataframe w

[R] paste first row string onto every string in column

2009-08-11 Thread Jill Hollenbach
hat I want is this: >dfnew V1 V2 V3 V4 1 DPA1* DPA1* DPB1* DPB1* 2 DPA1*0103 DPA1*0104 DPB1*0401 DPB1*0601 3 DPA1*0103 DPA1*0103 DPB1*0301 DPB1*0402 any help is much appreciated, I am new to this and struggling. Jill ___ Jill Hollenbach, PhD, MPH Assistant