Dear mailing list I have a data that have 20,000 rows and 20 columns. Io wonted to extract the 10th row only. Example the 10th, 20th, 30th 40th…..20000 th. can you please help me how do I do that.Than kyou. Example is below. Inpute: AG GG GG AG CC CC CC CC CT CC CT CT GG GG GG GG CC CC CC CC GG GG GG GG CC CC CC CC GG CG CG GG GG GG GG GG *CC CC CC CC* AA AG AG AA AA AA AA AA GG AG AG GG GG AG AG GG GG GG GG GG TT TT TT TT AA AG AG AA CT CC CT TT AG AA AG GG *AA AA AG AG* AA AA AA AA CC CC CC CG GG GG GG AG CT TT CT CT AT AA AT AT GG GG GG AG CG CC CG GG GG GG GG AG CC CC CC CT GG GG GG GG *GG GG AG AG *CC CC CC CT TT TT TT CT AG GG AG AG GG GG GG GG AG AG AA AA AG GG AG AA CT TT CT CT CT CT CC CT *AC CC AC AC* output *CC CC CC CC AA AA AG AG GG GG GG GG AC CC AC AC* thankyou a lot inadvance! [[alternative HTML version deleted]]
This should work: data[seq(1,nrow(data),10),] Andris On Piektdiena, 30. J??nijs 2006 14:45, yohannes alazar wrote:> Dear mailing list I have a data that have 20,000 rows and 20 columns. Io > wonted to extract the 10th row only. Example the 10th, 20th, 30th > 40th?..20000 th. can you please help me how do I do that.Than kyou. > Example is below. > Inpute: > AG GG GG AG > CC CC CC CC > CT CC CT CT > GG GG GG GG > CC CC CC CC > GG GG GG GG > CC CC CC CC > GG CG CG GG > GG GG GG GG > *CC CC CC CC* > AA AG AG AA > AA AA AA AA > GG AG AG GG > GG AG AG GG > GG GG GG GG > TT TT TT TT > AA AG AG AA > CT CC CT TT > AG AA AG GG > *AA AA AG AG* > AA AA AA AA > CC CC CC CG > GG GG GG AG > CT TT CT CT > AT AA AT AT > GG GG GG AG > CG CC CG GG > GG GG GG AG > CC CC CC CT > GG GG GG GG > *GG GG AG AG > *CC CC CC CT > TT TT TT CT > AG GG AG AG > GG GG GG GG > AG AG AA AA > AG GG AG AA > CT TT CT CT > CT CT CC CT > *AC CC AC AC* > > output > *CC CC CC CC > AA AA AG AG > GG GG GG GG > AC CC AC AC* > > thankyou a lot inadvance! > > [[alternative HTML version deleted]]
mydf[seq(10,20000,10),] yohannes alazar wrote:> Dear mailing list I have a data that have 20,000 rows and 20 columns. Io > wonted to extract the 10th row only. Example the 10th, 20th, 30th 40th?..20000 > th. can you please help me how do I do that.Than kyou. > Example is below. > Inpute: > AG GG GG AG > CC CC CC CC > CT CC CT CT > GG GG GG GG > CC CC CC CC > GG GG GG GG > CC CC CC CC > GG CG CG GG > GG GG GG GG > *CC CC CC CC* > AA AG AG AA > AA AA AA AA > GG AG AG GG > GG AG AG GG > GG GG GG GG > TT TT TT TT > AA AG AG AA > CT CC CT TT > AG AA AG GG > *AA AA AG AG* > AA AA AA AA > CC CC CC CG > GG GG GG AG > CT TT CT CT > AT AA AT AT > GG GG GG AG > CG CC CG GG > GG GG GG AG > CC CC CC CT > GG GG GG GG > *GG GG AG AG > *CC CC CC CT > TT TT TT CT > AG GG AG AG > GG GG GG GG > AG AG AA AA > AG GG AG AA > CT TT CT CT > CT CT CC CT > *AC CC AC AC* > > output > *CC CC CC CC > AA AA AG AG > GG GG GG GG > AC CC AC AC* > > thankyou a lot inadvance! > > [[alternative HTML version deleted]] > > > > ------------------------------------------------------------------------ > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html-- Chuck Cleland, Ph.D. NDRI, Inc. 71 West 23rd Street, 8th floor New York, NY 10010 tel: (212) 845-4495 (Tu, Th) tel: (732) 512-0171 (M, W, F) fax: (917) 438-0894
you need something like: new.data <- data[seq(10, nrow(data), 10), ] I hope it helps. Best, Dimitris ---- Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/(0)16/336899 Fax: +32/(0)16/337015 Web: http://med.kuleuven.be/biostat/ http://www.student.kuleuven.be/~m0390867/dimitris.htm ----- Original Message ----- From: "yohannes alazar" <hannesalazar at gmail.com> To: <r-help at stat.math.ethz.ch> Sent: Friday, June 30, 2006 1:45 PM Subject: [R] data extraction Dear mailing list I have a data that have 20,000 rows and 20 columns. Io wonted to extract the 10th row only. Example the 10th, 20th, 30th 40th...20000 th. can you please help me how do I do that.Than kyou. Example is below. Inpute: AG GG GG AG CC CC CC CC CT CC CT CT GG GG GG GG CC CC CC CC GG GG GG GG CC CC CC CC GG CG CG GG GG GG GG GG *CC CC CC CC* AA AG AG AA AA AA AA AA GG AG AG GG GG AG AG GG GG GG GG GG TT TT TT TT AA AG AG AA CT CC CT TT AG AA AG GG *AA AA AG AG* AA AA AA AA CC CC CC CG GG GG GG AG CT TT CT CT AT AA AT AT GG GG GG AG CG CC CG GG GG GG GG AG CC CC CC CT GG GG GG GG *GG GG AG AG *CC CC CC CT TT TT TT CT AG GG AG AG GG GG GG GG AG AG AA AA AG GG AG AA CT TT CT CT CT CT CC CT *AC CC AC AC* output *CC CC CC CC AA AA AG AG GG GG GG GG AC CC AC AC* thankyou a lot inadvance! [[alternative HTML version deleted]] --------------------------------------------------------------------------------> ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.htmlDisclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm