Just split, unlist, and form into a matrix. Take the rows of the matrix and
form new matrices.

Like

split_probes <- unlist(strsplit(as.matrix(probe_int), ",", fixed=TRUE),
                                          use.names=FALSE)
split_mat <- matrix(split_probes, nrow = 2)
probe_int_s <- matrix(split_mat[1,], ...)
probe_int_b <- matrix(split_mat[2,], ...)

or something

On Mon, Apr 4, 2011 at 8:11 AM, Christoph Bartenhagen <
Christoph.Bartenhagen@ukmuenster.de> wrote:

> Hi,
>
> not sure if that's is the best way, but this is what came to my mind:
>
> temp = strsplit(as.character(probe_int), split=",")
> probe_int_s = matrix(sapply(temp, function(x) x[1]), nrow(probe_int),
> ncol(probe_int))
> probe_int_b = matrix(sapply(temp, function(x) x[2]), nrow(probe_int),
> ncol(probe_int))
>
>
> Hope this helps and does what you want.
> Greetings,
> Christoph
>
>
> Am 04.04.2011 16:49, schrieb Ou, Jianhong:
>
>  Hi all,
>> I have data frame (probe_int) as:
>>
>> col1 col2 col3 ...
>> 12,1 11,2 12,1 ...
>> 10,1 11,1 11,2 ...
>> ....
>>
>> I want to separate the data into two matrix by comma like:
>> matrix1 (probe_int_s):
>> col1 col2 col3 ...
>> 12   11   12   ...
>> 10   11   11   ...
>> ...
>>
>> matrix2 (probe_int_b):
>> col1 col2 col3 ...
>> 1    2     1 ...
>> 1    1     2 ...
>> ....
>>
>> My code:
>> for(i in 1:nrow(probe_int)){
>> for(j in 1:ncol(probe_int)){
>> temp<-strsplit(as.character(probe_int[i,j]),",")
>> probe_int_s[i,j]<-as.numeric(temp[[1]][1])
>> probe_int_b[i,j]<-as.numeric(temp[[1]][2])
>> }
>> }
>>
>> Is there any clean and grace methods to do that? Thanks.
>>
>> Yours sincerely,
>>
>> Jianhong Ou
>>
>> jianhong.ou@umassmed.edu<mailto:jianhong.ou@umassmed.edu>
>>
>>
>>
>>        [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> Bioconductor mailing list
>> Bioconductor@r-project.org
>> https://stat.ethz.ch/mailman/listinfo/bioconductor
>> Search the archives:
>> http://news.gmane.org/gmane.science.biology.informatics.conductor
>>
>>
>>
>
>
> --
> Christoph Bartenhagen
> Institute of Medical Informatics
> University of Münster
> Domagkstraße 9
> 48149 Münster, Germany
>
> phone: +49 (0)251/83-58367
> mail:  Christoph.Bartenhagen@ukmuenster.de
> web:   http://imi.uni-muenster.de
>
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor@r-project.org
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives:
> http://news.gmane.org/gmane.science.biology.informatics.conductor
>

	[[alternative HTML version deleted]]

