简体   繁体   中英

How to save the first N rows of a table in R into a file?

I have a table data structure that contains 10000 rows (using R package). I know how to save the whole object using the function write.table(...); however, I am wondering if there is an easy way to save just the first N rows ( in the same order ) of that table, where N<10000. I am sure I can use a loop to iterate over the first N rows of the table, but an easier predefined function or parameter would always be helpful. Any ideas?

使用object[1:N,]write.table ();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM