[R] a function more appropriate than 'sapply'?

arun smartpink111 at yahoo.com
Sat Jan 26 20:34:59 CET 2013

May be this helps:

  #   V1 V2
#1  w7_1  0
#2 w11_1  0
#3 w12_1  0
#4 w13_1  0
#5 w14_1  0
#6 w15_1  0

#            V1 V2
#851 99_10_4395  0
#852 99_10_4396  0
#853 99_10_4400  0
#854 99_10_4403  0
#855 99_10_4404  0
#856 99_10_4606  0
#[1] 46366
#[1] 38080
#[1] 8286
#[1] 46366

----- Original Message -----
From: emorway <emorway at usgs.gov>
To: r-help at r-project.org
Sent: Saturday, January 26, 2013 1:43 PM
Subject: [R] a function more appropriate than 'sapply'?

I'm wondering if I need to use a function other than sapply as the following
line of code runs indefinitely (or > 30 min so far) and uses up all 16Gb of
memory on my machine for what seems like a very small dataset (data attached
in a txt file  wells.txt
<http://r.789695.n4.nabble.com/file/n4656723/wells.txt>  ).  The R code is:


The 2nd line of R code above gets bogged down and takes all my RAM with it:

I'm simply trying to extract all of the lines of data that have a single "_"
in the first column and place them into a dataset called "wells2".  If that
were to work, I then want to extract the lines of data that have two "_" and
put them into a separate dataset, say "wells3".  Is there a better way to do
this than the one-liner above?


View this message in context: http://r.789695.n4.nabble.com/a-function-more-appropriate-than-sapply-tp4656723.html
Sent from the R help mailing list archive at Nabble.com.

R-help at r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list