Skip to content
Back to formatted view

Raw Message

Message-ID: <687088457.8022659.1406919490250.JavaMail.zimbra@stanford.edu>
Date: 2014-08-01T18:58:10Z
From: Stephen HK Wong
Subject: How to randomly extract a number of rows in a data frame

Dear ALL,

I have a dataframe contains 4 columns and several 10 millions of rows like below! I want to extract out "randomly" say 1 millions of rows, can you tell me how to do that in R using base packages? Many Thanks!!!!

Col_1	Col_2	Col_3	Col_4
chr1	3000215	3000250	-
chr1	3000909	3000944	+
chr1	3001025	3001060	+
chr1	3001547	3001582	+
chr1	3002254	3002289	+
chr1	3002324	3002359	-
chr1	3002833	3002868	-
chr1	3004565	3004600	-
chr1	3004945	3004980	+
chr1	3004974	3005009	-
chr1	3005115	3005150	+
chr1	3005124	3005159	+
chr1	3005240	3005275	-
chr1	3005558	3005593	-
chr1	3005890	3005925	+
chr1	3005929	3005964	+
chr1	3005913	3005948	-
chr1	3005913	3005948	-

Stephen HK Wong