Error in rep(seq_no,times = as.vector(distance[,3])):invaild 'times' argument

My R script always reports error in win10:“Error in rep(seq_no,times = as.vector(distance[,3])):invaild 'times' argument”,but win 7 can run

seq_import<-function(input_file){
        my_fasta<-readLines(input_file);
        y<-regexpr("^>",my_fasta,perl = T);
        y[y==1]<-0;
        index<-which(y==0);
        distance<data.frame(start=index[1:(length(index)-1)],end=index[2:length(index)]);
    distance<rbind(distance,c(distance[length(distance[,1]),2],length(y)+1));
        distance<- data.frame(distance,dist=distance[,2]-distance[,1]);
        seq_no<-1:length(y[y==0]);
        index<-rep(seq_no,as.vector(distance[,3])); #reports error
        my_fasta<-data.frame(index,y,my_fasta);
        my_fasta[my_fasta[,2]==0,1]<-0
seqs<tapply(as.vector(my_fasta[,3]),factor(my_fasta[,1]),paste,collapse="",simplify= F);
        seqs<-as.character(seqs[2:length(seqs)]);
        Desc<-as.vector(my_fasta[c(grep("^>",as.character(my_fasta[,3]),perl= TRUE)),3]);
        my_fasta<-data.frame(Desc,Length=nchar(seqs),seqs);
        Acc<-gsub(".*gb\\|(.*)\\|.*","\\1",as.character(my_fasta[,1]),perl =
    T);
        my_fasta<-data.frame(Acc,my_fasta);
        my_fasta;
        }