I am a beginner in R. I wrote a function to read a data frame from a file and then split it into certain number of data frames and write each one of them in a separate txt file. the function is working perfectly for the first four files the it gives me files contain one column of NA values.
split= function (filename,linesno,filesno) { i=1 j=linesno k=1 e=1 x=read.table(filename, sep=("\t"), header= FALSE) for (i in 1:filesno){ xx=x[e:j, ] l=paste0(filename,0,k,".pdb") write.table(xx, l, quote =FALSE, sep = "\t",row.names = FALSE, col.names = FALSE) k=k+1 e=e+j j=2*j } } what could be the problem? Esam ______________________________________________ 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.