Thanks Jorge, for your reply. In the end I changed my approach and used a
sub() strategy I found on this forum to recover the prefixes as below.
IDs.prefix <- sub("([^*])(_.*)", "\\1" , sampleIDs )
IDs.split <- cbind(sampleIDs , IDs.prefix)
Regards
M
--
View this message in context:
http://r.
Try
sapply(strsplit(sampleIDs, "_"), "[", 1)
HTH,
Jorge
On Wed, Dec 22, 2010 at 4:02 PM, maddox <> wrote:
>
> Dear Guru's
>
> My first steps with R have ground to a halt! I have a vector of sample
> identifiers
>
> > sampleIDs
> [1] "D1_1" "D1_2" "D1_3" "D1_4" "D1_5" "D1_6" "D1_7"
There are several ways to get a matrix, for example
mat = as.matrix(as.data.frame(splitIDs))
or
mat = sapply(splitIDs, I)
True experts may suggests even more ways.
Peter
On Wed, Dec 22, 2010 at 1:02 PM, maddox wrote:
>
> Dear Guru's
>
> My first steps with R have ground to a halt! I have a v
--
View this message in context:
http://r.789695.n4.nabble.com/vectorised-recovery-of-strsplit-value-tp3161254p3161389.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/lis
Dear Guru's
My first steps with R have ground to a halt! I have a vector of sample
identifiers
> sampleIDs
[1] "D1_1" "D1_2" "D1_3" "D1_4" "D1_5" "D1_6" "D1_7" "D1_8"
[9] "D1_9" "D1_10" "D1_11" "D1_12" "F1_13" "F1_14" "F1_15" "F1_16"
[17] "F1_17" "F1_18" "F1_19" "F1
5 matches
Mail list logo