# align
#
#' Load a Matrix
#'
#' This function loads a file as a matrix. It assumes that the first column
#' contains the rownames and the subsequent columns are the sample identifiers.
#' Any rows with duplicated row names will be dropped with the first one being
#' indexOf(str,str2),str the son,str2is the mom,returen the position of the son in mom
#'
#' @param infile Path to the input file
#' @return A matrix of the infile
#' @export
indexOf = function(str,str2){
cd=nchar(str);
cd2=nchar(str2);
if(cd==0||cd2==0){
return(0);
}
for(i in 1:cd){
t=substr(str,i,i);
for(j in 1:cd2){
if(t==substr(str2,j,j)&&j==1){
if(cd2==1){
return(i);
}else{
c=TRUE;
for(k in 1:(cd2-1)){
if(substr(str,i+k,i+k)!=substr(str2,j+k,j+k)){
c=FALSE;
break;
}
}
if(c==TRUE){
return(i);
}
}
}else{
break;
}
}
}
return(0);
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.