Jonathan Greenberg
2013-Sep-27 19:13 UTC
[R] Error: C stack usage is too close to the limit when using list.files()
R-helpers: I'm running a file search on my entire drive (Mac OS X) using: files_found <- list.files(dir="/",pattern=somepattern,recursive=TRUE,full.names=TRUE) where somepattern is a search pattern (which I have confirmed via a unix "find / -name somepattern" only returns ~ 3 results). I keep getting an error: Error: C stack usage is too close to the limit when running this command. Any ideas on 1) how to fix this or 2) if there is an alternative to using list.files() to accomplish this search without resorting to an external package? Cheers! --jonathan -- Jonathan A. Greenberg, PhD Assistant Professor Global Environmental Analysis and Remote Sensing (GEARS) Laboratory Department of Geography and Geographic Information Science University of Illinois at Urbana-Champaign 259 Computing Applications Building, MC-150 605 East Springfield Avenue Champaign, IL 61820-6371 Phone: 217-300-1924 http://www.geog.illinois.edu/~jgrn/ AIM: jgrn307, MSN: jgrn307 at hotmail.com, Gchat: jgrn307, Skype: jgrn3007
Ben Bolker
2013-Sep-27 19:36 UTC
[R] Error: C stack usage is too close to the limit when using list.files()
Jonathan Greenberg <jgrn <at> illinois.edu> writes:> > R-helpers: > > I'm running a file search on my entire drive (Mac OS X) using: > > files_found <-list.files(dir="/",pattern=somepattern,recursive=TRUE,full.names=TRUE)> where somepattern is a search pattern (which I have confirmed via a > unix "find / -name somepattern" only returns ~ 3 results). > > I keep getting an error: > > Error: C stack usage is too close to the limit > > when running this command. Any ideas on 1) how to fix this or 2) if > there is an alternative to using list.files() to accomplish this > search without resorting to an external package?I assuming that using system("find / -name somepattern") (possibly with intern=TRUE) isn't allowed? (I don't know what you're trying to do, but if you don't need it to work on Windows-without-cygwin, this should work across most Unix variants (although a "-print" might be required)
William Dunlap
2013-Sep-27 19:56 UTC
[R] Error: C stack usage is too close to the limit when using list.files()
Do you have some symbolic links that make loops in your file system? list.files() has problems with such loops and find does not. E.g., on a Linux box: % cd /tmp % mkdir dir dir/subdir % cd dir/subdir % ln -s ../../dir linkToUpperDir % cd /tmp % R --quiet> list.files("dir", recursive=TRUE, full=TRUE)[1] "dir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir"> system("find dir")dir dir/subdir dir/subdir/linkToUpperDir Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com> -----Original Message----- > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf > Of Jonathan Greenberg > Sent: Friday, September 27, 2013 12:13 PM > To: r-help > Subject: [R] Error: C stack usage is too close to the limit when using list.files() > > R-helpers: > > I'm running a file search on my entire drive (Mac OS X) using: > > files_found <- list.files(dir="/",pattern=somepattern,recursive=TRUE,full.names=TRUE) > where somepattern is a search pattern (which I have confirmed via a > unix "find / -name somepattern" only returns ~ 3 results). > > I keep getting an error: > > Error: C stack usage is too close to the limit > > when running this command. Any ideas on 1) how to fix this or 2) if > there is an alternative to using list.files() to accomplish this > search without resorting to an external package? > > Cheers! > > --jonathan > > > -- > Jonathan A. Greenberg, PhD > Assistant Professor > Global Environmental Analysis and Remote Sensing (GEARS) Laboratory > Department of Geography and Geographic Information Science > University of Illinois at Urbana-Champaign > 259 Computing Applications Building, MC-150 > 605 East Springfield Avenue > Champaign, IL 61820-6371 > Phone: 217-300-1924 > http://www.geog.illinois.edu/~jgrn/ > AIM: jgrn307, MSN: jgrn307 at hotmail.com, Gchat: jgrn307, Skype: jgrn3007 > > ______________________________________________ > R-help at 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.