Re: [R] Error: C stack usage is too close to the limit when using list.files()
FYI, in R.utils (= 1.28.4) you can use listDirectory() to control how deep the recursion goes, which would give you protection against your problem, e.g. R.utils::listDirectory(dir, recursive=5L) where recursive=0L is equivalent to recursive=FALSE. Using recursive=TRUE corresponds to recursive=+Inf, that is infinite depth. listDirectory() accepts similar arguments that list.files() does. /Henrik On Sat, Sep 28, 2013 at 5:06 PM, William Dunlap wdun...@tibco.com wrote: The issue is not symbolic links per se, but ones that form loops. Note that you can detect such loops by running 'find -L ...' and looking for the error messages. (find by default does not follow any symbolic links, which can be a problem also.) It is a shortcoming of the current version of list.files(). Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message- From: jgrn...@gmail.com [mailto:jgrn...@gmail.com] On Behalf Of Jonathan Greenberg Sent: Saturday, September 28, 2013 10:51 AM To: William Dunlap Cc: r-help Subject: Re: [R] Error: C stack usage is too close to the limit when using list.files() Thanks all -- ok, so the symbolic link issue is a distinct possibility, but fundamentally doesn't solve the issue since most users will have symbolic links on their machines SOMEPLACE, so a full drive scan will run into these issues -- is list.files calling find, or is it using a different algorithm? This seems like a shortcoming in the list.files algorithm -- is there a better solution (short of a System call, which I'm still not sure will work on Macs without Xcode -- a colleague of mine did NOT have Xcode, and reported not being able to run find from the command line) -- perhaps a different package? --j On Fri, Sep 27, 2013 at 3:08 PM, William Dunlap wdun...@tibco.com wrote: Toss a couple of extra files in there and you will see the output grow exponentially. % touch dir/IMPORTANT_1 dir/subdir/IMPORTANT_2 and in R those two new files cause 82 more strings to appear in list.file's output: nchar(list.files(dir, recursive=TRUE)) [1] 11 18 33 40 55 62 77 84 99 106 121 128 143 150 165 172 187 194 209 [20] 216 231 238 253 260 275 282 297 304 319 326 341 348 363 370 385 392 407 414 [39] 429 436 451 458 473 480 495 502 517 524 539 546 561 568 583 590 605 612 627 [58] 634 649 656 671 678 693 700 715 722 737 744 759 766 781 788 803 810 825 832 [77] 847 854 869 876 891 898 901 'find', by default, does not following symbolic links. % find dir dir dir/subdir dir/subdir/IMPORTANT_2 dir/subdir/linkToUpperDir dir/IMPORTANT_1 The -L option makes it follow them, but it won't follow loops: % find -L dir dir dir/subdir dir/subdir/IMPORTANT_2 find: File system loop detected; `dir/subdir/linkToUpperDir' is part of the same file system loop as `dir'. dir/IMPORTANT_1 Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of William Dunlap Sent: Friday, September 27, 2013 12:56 PM To: Jonathan Greenberg; r-help Subject: Re: [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/linkToU pperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkT oUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/li nkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdi r/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/su bdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir /subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpper Dir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUp perDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkTo UpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/lin kToUpperDir/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-boun...@r-project.org [mailto:r-help-boun...@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
Re: [R] Error: C stack usage is too close to the limit when using list.files()
Thanks all -- ok, so the symbolic link issue is a distinct possibility, but fundamentally doesn't solve the issue since most users will have symbolic links on their machines SOMEPLACE, so a full drive scan will run into these issues -- is list.files calling find, or is it using a different algorithm? This seems like a shortcoming in the list.files algorithm -- is there a better solution (short of a System call, which I'm still not sure will work on Macs without Xcode -- a colleague of mine did NOT have Xcode, and reported not being able to run find from the command line) -- perhaps a different package? --j On Fri, Sep 27, 2013 at 3:08 PM, William Dunlap wdun...@tibco.com wrote: Toss a couple of extra files in there and you will see the output grow exponentially. % touch dir/IMPORTANT_1 dir/subdir/IMPORTANT_2 and in R those two new files cause 82 more strings to appear in list.file's output: nchar(list.files(dir, recursive=TRUE)) [1] 11 18 33 40 55 62 77 84 99 106 121 128 143 150 165 172 187 194 209 [20] 216 231 238 253 260 275 282 297 304 319 326 341 348 363 370 385 392 407 414 [39] 429 436 451 458 473 480 495 502 517 524 539 546 561 568 583 590 605 612 627 [58] 634 649 656 671 678 693 700 715 722 737 744 759 766 781 788 803 810 825 832 [77] 847 854 869 876 891 898 901 'find', by default, does not following symbolic links. % find dir dir dir/subdir dir/subdir/IMPORTANT_2 dir/subdir/linkToUpperDir dir/IMPORTANT_1 The -L option makes it follow them, but it won't follow loops: % find -L dir dir dir/subdir dir/subdir/IMPORTANT_2 find: File system loop detected; `dir/subdir/linkToUpperDir' is part of the same file system loop as `dir'. dir/IMPORTANT_1 Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of William Dunlap Sent: Friday, September 27, 2013 12:56 PM To: Jonathan Greenberg; r-help Subject: Re: [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/linkToU pperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkT oUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/li nkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdi r/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/su bdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir /subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpper Dir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUp perDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkTo UpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/lin kToUpperDir/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-boun...@r-project.org [mailto:r-help-boun...@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: jgrn...@hotmail.com, Gchat: jgrn307, Skype: jgrn3007 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide
Re: [R] Error: C stack usage is too close to the limit when using list.files()
On 28-09-2013, at 19:51, Jonathan Greenberg j...@illinois.edu wrote: Thanks all -- ok, so the symbolic link issue is a distinct possibility, but fundamentally doesn't solve the issue since most users will have symbolic links on their machines SOMEPLACE, so a full drive scan will run into these issues -- is list.files calling find, or is it using a different algorithm? This seems like a shortcoming in the list.files algorithm -- is there a better solution (short of a System call, which I'm still not sure will work on Macs without Xcode -- a colleague of mine did NOT have Xcode, and reported not being able to run find from the command line) -- perhaps a different package? Since Mac OS X Tiger at least there is a find utility. By doing a search here http://www.opensource.apple.com you can see that there is a find utility since 10.0 (to be found here http://www.opensource.apple.com/source/shell_cmds/shell_cmds-17.1/ ). There must be something wrong with your colleague's setup. Berend __ R-help@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.
Re: [R] Error: C stack usage is too close to the limit when using list.files()
The issue is not symbolic links per se, but ones that form loops. Note that you can detect such loops by running 'find -L ...' and looking for the error messages. (find by default does not follow any symbolic links, which can be a problem also.) It is a shortcoming of the current version of list.files(). Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message- From: jgrn...@gmail.com [mailto:jgrn...@gmail.com] On Behalf Of Jonathan Greenberg Sent: Saturday, September 28, 2013 10:51 AM To: William Dunlap Cc: r-help Subject: Re: [R] Error: C stack usage is too close to the limit when using list.files() Thanks all -- ok, so the symbolic link issue is a distinct possibility, but fundamentally doesn't solve the issue since most users will have symbolic links on their machines SOMEPLACE, so a full drive scan will run into these issues -- is list.files calling find, or is it using a different algorithm? This seems like a shortcoming in the list.files algorithm -- is there a better solution (short of a System call, which I'm still not sure will work on Macs without Xcode -- a colleague of mine did NOT have Xcode, and reported not being able to run find from the command line) -- perhaps a different package? --j On Fri, Sep 27, 2013 at 3:08 PM, William Dunlap wdun...@tibco.com wrote: Toss a couple of extra files in there and you will see the output grow exponentially. % touch dir/IMPORTANT_1 dir/subdir/IMPORTANT_2 and in R those two new files cause 82 more strings to appear in list.file's output: nchar(list.files(dir, recursive=TRUE)) [1] 11 18 33 40 55 62 77 84 99 106 121 128 143 150 165 172 187 194 209 [20] 216 231 238 253 260 275 282 297 304 319 326 341 348 363 370 385 392 407 414 [39] 429 436 451 458 473 480 495 502 517 524 539 546 561 568 583 590 605 612 627 [58] 634 649 656 671 678 693 700 715 722 737 744 759 766 781 788 803 810 825 832 [77] 847 854 869 876 891 898 901 'find', by default, does not following symbolic links. % find dir dir dir/subdir dir/subdir/IMPORTANT_2 dir/subdir/linkToUpperDir dir/IMPORTANT_1 The -L option makes it follow them, but it won't follow loops: % find -L dir dir dir/subdir dir/subdir/IMPORTANT_2 find: File system loop detected; `dir/subdir/linkToUpperDir' is part of the same file system loop as `dir'. dir/IMPORTANT_1 Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of William Dunlap Sent: Friday, September 27, 2013 12:56 PM To: Jonathan Greenberg; r-help Subject: Re: [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/linkToU pperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkT oUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/li nkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdi r/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/su bdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir /subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpper Dir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUp perDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkTo UpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/lin kToUpperDir/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-boun...@r-project.org [mailto:r-help-boun...@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
Re: [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) __ R-help@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.
Re: [R] Error: C stack usage is too close to the limit when using list.files()
Ben: I'd like to avoid using that (previous version of my code solved it in that way) -- I would like cross-platform compatibility and I am pretty sure, along with Windows, vanilla Macs don't come with find either unless XCode has been installed. Is the list.files() code itself recursive when using recursive=TRUE (so it has one recursion per bottom-folder)? --j P.S. I recognized that in my initial post I indicated using dir as the parameter -- it should have been path (the error occurred through the correct usage of list.files(path=/,...) That'll teach me not to copy/paste from my code... On Fri, Sep 27, 2013 at 2:36 PM, Ben Bolker bbol...@gmail.com wrote: 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) __ R-help@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. -- 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: jgrn...@hotmail.com, Gchat: jgrn307, Skype: jgrn3007 __ R-help@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.
Re: [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-boun...@r-project.org [mailto:r-help-boun...@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: jgrn...@hotmail.com, Gchat: jgrn307, Skype: jgrn3007 __ R-help@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. __ R-help@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.
Re: [R] Error: C stack usage is too close to the limit when using list.files()
On 27-09-2013, at 21:50, Jonathan Greenberg j...@illinois.edu wrote: Ben: I'd like to avoid using that (previous version of my code solved it in that way) -- I would like cross-platform compatibility and I am pretty sure, along with Windows, vanilla Macs don't come with find either unless XCode has been installed. As far as I can tell Mac OS X provides a find utility (the Unix version). It is not part of Xcode. Berend Is the list.files() code itself recursive when using recursive=TRUE (so it has one recursion per bottom-folder)? --j P.S. I recognized that in my initial post I indicated using dir as the parameter -- it should have been path (the error occurred through the correct usage of list.files(path=/,...) That'll teach me not to copy/paste from my code... On Fri, Sep 27, 2013 at 2:36 PM, Ben Bolker bbol...@gmail.com wrote: 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) __ R-help@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. -- 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: jgrn...@hotmail.com, Gchat: jgrn307, Skype: jgrn3007 __ R-help@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. __ R-help@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.
Re: [R] Error: C stack usage is too close to the limit when using list.files()
Toss a couple of extra files in there and you will see the output grow exponentially. % touch dir/IMPORTANT_1 dir/subdir/IMPORTANT_2 and in R those two new files cause 82 more strings to appear in list.file's output: nchar(list.files(dir, recursive=TRUE)) [1] 11 18 33 40 55 62 77 84 99 106 121 128 143 150 165 172 187 194 209 [20] 216 231 238 253 260 275 282 297 304 319 326 341 348 363 370 385 392 407 414 [39] 429 436 451 458 473 480 495 502 517 524 539 546 561 568 583 590 605 612 627 [58] 634 649 656 671 678 693 700 715 722 737 744 759 766 781 788 803 810 825 832 [77] 847 854 869 876 891 898 901 'find', by default, does not following symbolic links. % find dir dir dir/subdir dir/subdir/IMPORTANT_2 dir/subdir/linkToUpperDir dir/IMPORTANT_1 The -L option makes it follow them, but it won't follow loops: % find -L dir dir dir/subdir dir/subdir/IMPORTANT_2 find: File system loop detected; `dir/subdir/linkToUpperDir' is part of the same file system loop as `dir'. dir/IMPORTANT_1 Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of William Dunlap Sent: Friday, September 27, 2013 12:56 PM To: Jonathan Greenberg; r-help Subject: Re: [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/linkToU pperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkT oUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/li nkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdi r/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/su bdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir /subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpper Dir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUp perDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkTo UpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/linkToUpperDir/subdir/lin kToUpperDir/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-boun...@r-project.org [mailto:r-help-boun...@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: jgrn...@hotmail.com, Gchat: jgrn307, Skype: jgrn3007 __ R-help@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. __ R-help@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. __ R-help@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.
Re: [R] Error: C stack usage is too close to the limit
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Luis Ridao Cruz Sent: Monday, September 14, 2009 6:24 AM To: R-help Subject: [R] Error: C stack usage is too close to the limit R-help, I 'm trying to optimize a model to data using log-likelihoods but I encounter the following error message: l= c(49.4, 57.7,64.8,70.9,78.7,86.6,88.3,91.6,99,115) t=3:12 fn - function(params, l=l, t=t) { You should not make the default value of an argument be the argument itself or a function of itself as that leads to infinite recursion. Make l and t free variables (to be retrieved from the environment that fn is defined in) or give the function argument a different name than its default value (so the default value is read from the defining environment) or use no default value and have optim pass in the arguments on each call. Bill Dunlap TIBCO Software Inc - Spotfire Division wdunlap tibco.com Linf - params[1] k - params[2] t0 - params[3] sigma - params[4] lhat - params[1]*(1-exp(-params[2]*(t-params[3]))) logL - -sum(dnorm(log(l),log(lhat),sqrt(sigma),TRUE)) return(logL) } resop - optim(c(120, .1, 0, 1), fn, method=L-BFGS-B,lower=c(0.0, 0.001, 0.001,0.01) + ,upper = rep(Inf, 4), hessian=TRUE, control=list(trace=1)) Error: C stack usage is too close to the limit Thanks in advance. Running R on a Windows XP machine version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major 2 minor 8.1 year 2008 month 12 day22 svn rev47281 language R version.string R version 2.8.1 (2008-12-22) __ R-help@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. __ R-help@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.
Re: [R] Error: C stack usage is too close to the limit (can't understand explanations of how to fix this)
I can't find any file called Rinterface.h on my computer. What folder is it supposed to be in? you can find the R_CStackLimit in Rinterface.h after that you will know how to use it! Apparently the way to deal with this error message is to set R_CStackLimit = (uintptr_t)-1 I tried typing this in the R console, but it says Error: object R_CStackLimit not found. So where do I type it? In one of the initialization files that R uses when it starts up? I can't find the answer anywhere. Please note that I don't understand words like DLL or embed, and I don't understand how R works at any deep level. I am using R 2.8.1 on Windows XP. -- View this message in context: http://www.nabble.com/%22Error%3A-C-stack-usage-is-too-close-to-the-limit%22-%28can%27t-understand-explanations-of-how-to-fix-this%29-tp23650518p23811653.html Sent from the R help mailing list archive at Nabble.com. __ R-help@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.
Re: [R] Error: C stack usage is too close to the limit (can't understand explanations of how to fix this)
you can find the R_CStackLimit in Rinterface.h after that you will know how to use it! ÔÚ2009-05-21?17:53:54£¬anon36?ano...@yahoo.com?дµÀ£º Apparently?the?way?to?deal?with?this?error?message?is?to?set ??R_CStackLimit?=?(uintptr_t)-1 I?tried?typing?this?in?the?R?console,?but?it?says?Error:?object R_CStackLimit?not?found. So?where?do?I?type?it??In?one?of?the?initialization?files?that?R?uses?when it?starts?up? I?can't?find?the?answer?anywhere.?Please?note?that?I?don't?understand?words like?DLL?or?embed,?and?I?don't?understand?how?R?works?at?any?deep?level. I?am?using?R?2.8.1?on?Windows?XP.? --? View?this?message?in?context:?http://www.nabble.com/%22Error%3A-C-stack-usage-is-too-close-to-the-limit%22-%28can%27t-understand-explanations-of-how-to-fix-this%29-tp23650518p23650518.html Sent?from?the?R?help?mailing?list?archive?at?Nabble.com. __ r-h...@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. [[alternative HTML version deleted]] __ R-help@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.
Re: [R] Error: C stack usage is too close to the limit
Your function has 4 parameters and you are only calling with two. The first statement: caldist - function(cage=Cage, error=Error, sdev=Sdev, times=Times, By=By) { theta - seq(min(calcurve[,1]), max(calcurve[,1]), by=By); use By which is not defined. On Jan 26, 2008 4:29 PM, Maarten Blaauw [EMAIL PROTECTED] wrote: Lately R has been behaving strange on my Linux (Ubuntu 7.10) machine, with occasional segfaults. Today something else and reproducible happened: If I type the code below (meant for calibrating data), I get the error message that the C stack usage is too close to the limit. calcurve - cbind(1:2e4, 1:2e4, 1:2e3); #dummy curve, real one is more complex caldist - function(cage=Cage, error=Error, sdev=Sdev, times=Times, By=By) { theta - seq(min(calcurve[,1]), max(calcurve[,1]), by=By); interpolate - function(th, col) { if(th==calcurve[1,1]) {calcurve[1,col]}else if(th==calcurve[nrow(calcurve),1]) {calcurve[nrow(calcurve),col]}else { k - min(which(calcurve[,1] th)); slope - (calcurve[k-1,col]-calcurve[k,col])/(calcurve[k-1,1]-calcurve[k,1]); calcurve[k-1,col] + slope*(th-calcurve[k-1,1]); } } mu - c(); cerror - c(); for(i in 1:length(theta)) { mu[i] - interpolate(theta[i],2); cerror[i] - interpolate(theta[i],3); } caldist - dnorm(mu, cage, (error^2+cerror^2)^.5); cbind(theta, caldist/sum(caldist)); } caldist(1e3,1e2); Unfortunately I am no huge computer wizard. Has anyone got any idea why this happens? Is it reproducible on other machines? How can I solve this problem? My R: R version 2.6.1 (2007-11-26) i486-pc-linux-gnu locale: LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via a namespace (and not attached): [1] rcompgen_0.1-17 Cstack_info() sizecurrent direction eval_depth 8388608 2404 1 2 Many thanks, Maarten Blaauw -- Dr. Maarten Blaauw School of Geography, Archaeology Palaeoecology Queen's University Belfast, U.K. On leave from Department of Earth Sciences Uppsala University, Sweden [EMAIL PROTECTED] __ R-help@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. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? __ R-help@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.
Re: [R] Error: C stack usage is too close to the limit
Sorry, indeed I forgot to put some of the factors in the code. Here it is again, now updated: calcurve - cbind(1:2e4, 1:2e4, rep(100, length=2e4)); caldist - function(cage, error, sdev=2, times=5, By=1) { calcurve - calcurve[which((calcurve[,2]+calcurve[,3]) = cage-(times*error)),]; calcurve - calcurve[which((calcurve[,2]-calcurve[,3]) = cage+(times*error)),]; theta - seq(min(calcurve[,1]), max(calcurve[,1]), by=By); interpolate - function(th, col) { if(th==calcurve[1,1]) {calcurve[1,col]}else if(th==calcurve[nrow(calcurve),1]) {calcurve[nrow(calcurve),col]}else { k - min(which(calcurve[,1] th)); slope - (calcurve[k-1,col]-calcurve[k,col])/(calcurve[k-1,1]-calcurve[k,1]); calcurve[k-1,col] + slope*(th-calcurve[k-1,1]); } } mu - c(); cerror - c(); for(i in 1:length(theta)) { mu[i] - interpolate(theta[i],2); cerror[i] - interpolate(theta[i],3); } caldist - dnorm(mu, cage, (error^2+cerror^2)^.5); cbind(theta, caldist/sum(caldist)); } caldist(2450,50); Strangely enough the stacking error message seems not to happen every time. It also has happened on the WinXP partition of the same Toshiba laptop. So it is not as reproducible as I first hoped/feared. -- Dr. Maarten Blaauw School of Geography, Archaeology Palaeoecology Queen's University Belfast, U.K. On leave from Department of Earth Sciences Uppsala University, Sweden [EMAIL PROTECTED] __ R-help@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.