What happens if you have multiple matches in the comparison between
the content_feat and ob_feat?  Why don't you just iterate through the
content_feat and use 'match' to find the corresponding match in
ob_feat?  This should speed it up.  Also why are you using 'as.matrix'
when the values in the 'if' statement are objects of size 1?  Are any
of the objects dataframes?  If so, convert them to matrices for
efficiency.

On Nov 12, 2007 12:09 PM, Mahmudul Haque <[EMAIL PROTECTED]> wrote:
> hi,
>
> please help me out in the following case. seems like it stuck in some 
> where(already 7 hrs passed). what I want is to combine 4 matrix in to one 
> matrix of desired length.
>
> final_matrix<-function(ob_feat,content_feat,link_feat,link_feat_transformed){
> complete_feat<-matrix(rep(-1),nrow=11402,ncol=278)
>
>
> for(i in 1:8944)
>    {q<-c(0)
>    for(j in 1:11402)
>        {
>        if(as.matrix(content_feat[i,2])==as.matrix(ob_feat[j,2]))
>            {complete_feat[i,1]=as.matrix(ob_feat[j,2])
>            complete_feat[i,2:97]=as.matrix(content_feat[i,3:98])
>            complete_feat[i,98:99]=as.matrix(ob_feat[j,3:4])
>            complete_feat[i,100:140]=as.matrix(link_feat[j,3:43])
>            complete_feat[i,141:278]=as.matrix(link_feat_transformed[j,3:140])
>               q<-1}
>        if(q==1)
>            break;
>        }
>
>
>    }
>    for (i in 8945:11402){
>        complete_feat[i,1]=as.matrix(ob_feat[i,2])
>        complete_feat[i,98:99]=as.matrix(ob_feat[i,3:4])
>        complete_feat[i,100:140]=as.matrix(link_feat[i,3:43])
>        complete_feat[i,141:278]=as.matrix(link_feat_transformed[i,3:140])
>        }
>
> list(complete_feat=complete_feat)
> }
>
> kind regards,
>
> mahmudul haque
>
>  __________________________________________________
>
>
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to