> flengthr < - function(rmap, N){ #rmap is a vector of restriction sites for a linear molecule # N is the length of the molecule frags<-rep(0, length(rmap)) # Vector for subtraction results: elements initialized to 0 rmap<-c(rmap,N) # Adds length of molecule for calculation of end piece. for(i in 1:(length(rmap)-1)){ frags[i] < - rmap[i+1]-rmap[i]} frags <- c(rmap[1],frags) # First term is left end piece return(frags) }