Re: [Rd] Possible changes to connections

2007-06-01 Thread Byron Ellis
On 5/31/07, Bill Dunlap <[EMAIL PROTECTED]> wrote:

> I like the idea of the connection being closed when there
> are no more references to it.  I guess that means when the
> garbage collector notices it has been orphaned, which may
> take a while.

Although, playing devil's advocate, it Green Book connections do
follow the same pattern as the other resource allocation type,
graphics devices. Not that this should be taken as endorsement, I
think I would like to see graphics devices head in the direction of
being actual objects as well (and I think I would want with() to be
involved with that).

It would also be really nice if connections became more like graphics
devices in that new connections could be implemented from a package.
That would make, for example, implementing clipboard connections on OS
X do the Right Thing under X11 and the GUI.

CLIM-style event streams would also be nice, but is almost surely too
much to ask. :-)

>
> However, one of my longstanding complaints about connections
> in Splus and R may have a bearing here also.  Currently, if you
> want to have your file opened in a particular way, say for
> only reading or for appending or in binary mode then you
> need to specify open=mode when calling file().  However that
> also tells it to actually open the file.  I would prefer that
> there was a mode= argument to file that meant that when the
> file is eventually opened it would be opened with that mode.
> open= should be restricted to TRUE or FALSE, or IMO, be eliminated.
> (We have an open() function for that.)  With the current system
>readLines(file(path))
> does not leave path open but
>readLines(file(path, "r"))
> does leave it open.  E.g., using readLines(file(path))
> as Seth did appears to work fine:
>   > system(paste("/usr/sbin/lsof -p", Sys.getpid(),"|grep /tmp/twolines.txt"))
>   > readLines(file("/tmp/twolines.txt"))
>   [1] "One," "two, and that is it."
>   > system(paste("/usr/sbin/lsof -p", Sys.getpid(),"|grep /tmp/twolines.txt"))
>   > # no lsof output means the file is not open
> but asking to have it opened in readonly and binary
> mode leaks a file descriptor:
>   > system(paste("/usr/sbin/lsof -p", Sys.getpid(),"|grep /tmp/twolines.txt"))
>   > readLines(file("/tmp/twolines.txt", open="rb"))
>   [1] "One," "two, and that is it."
>   > system(paste("/usr/sbin/lsof -p", Sys.getpid(),"|grep /tmp/twolines.txt"))
>   R   16950 bill3r   REG8,2   26   229597 /tmp/twolines.txt
> That difference sinces unnatural to me.
>
> Of course, we could just add the mode= argument and hope
> people started using it instead of open=.

Maybe the actual solution is actually two types of objects? An
abstract resource object that describes a potential connection and
then leave the connection object to active I/O streams?

>
> 
> Bill Dunlap
> Insightful Corporation
> bill at insightful dot com
> 360-428-8146
>
>  "All statements in this message represent the opinions of the author and do
>  not necessarily reflect Insightful Corporation policy or position."
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>


-- 
Byron Ellis ([EMAIL PROTECTED])
"Oook" -- The Librarian

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] Question on the R's C stack limit

2007-06-01 Thread Ev Whin
Dear r-devel members,
I encountered a C stack limit issue, when I tried to embed R 2.5 into my
application. In the R-exts document, it says:"Note that R's own front ends
use a stack size of 10Mb". I desire to know: is it possible to decrease this
stack size
by modifying R's source code? If it's possible, which part of the source
code is responsible for the issue?

Thank you all.

Whin

[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] Problem building R from source on Windows

2007-06-01 Thread Jonathan Swinton

I have a problem when building R from source on Windows XP.

When I get to 3.1.3 of the Installation and Administration manual and try
 make all recommended
from R_HOME it fails with 
 make: *** No rule to make target `all'.  Stop.

I am pretty sure there is an obvious and well documented thing I am missing,
but missing it I am. Any clues?

Is my problem that I have a Makefile.in but not a Makefile? Have I understood
section 3.1.3 correctly that no ./configure step is needed? Although my reading
of the I&A manual is that no ./configure step is needed under Windows, I did
wonder and tried running
 sh ./configure
but that failed with 
 chmod: not found
 chmod: not found
 chmod: not found
 configure: error: cannot create configure.lineno; rerun with a POSIX shell


make is GNU make 3.79.1; I don't know how to identify which sh it is but it is
the one in the Rtools\bin directory.

I having downloaded all the tools listed in Appendix E (save InnoSetup) and
installed them and set my path to be:

PATH=c:\Rtools\bin;C:\Perl\bin\;c:\Rtools\MinGW\bin;c:\progra~1\htmhe~1;C:\Progr
am Files\MiKTeX 2.6\miktex\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System3
2\Wbem;C:\Program Files\Subversion\bin

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Question on the R's C stack limit

2007-06-01 Thread Prof Brian Ripley
On Fri, 1 Jun 2007, Ev Whin wrote:

> Dear r-devel members,
>I encountered a C stack limit issue, when I tried to embed R 2.5 into my
> application. In the R-exts document, it says:"Note that R's own front ends
> use a stack size of 10Mb". I desire to know: is it possible to decrease this
> stack size
> by modifying R's source code? If it's possible, which part of the source
> code is responsible for the issue?

You have picked that out of the Windows-specific documentation without 
saying you are on Windows (are you?).  The setting is in 
src/gnuwin/front-ends, unsurprisingly.  (In the Makefile, to be exact.)

> Thank you all.
>
> Whin
>
>   [[alternative HTML version deleted]]

Please don't send HTML: see the posting guide.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Problem building R from source on Windows

2007-06-01 Thread Prof Brian Ripley
On Thu, 31 May 2007, Jonathan Swinton wrote:

>
> I have a problem when building R from source on Windows XP.
>
> When I get to 3.1.3 of the Installation and Administration manual and try
> make all recommended
> from R_HOME it fails with
> make: *** No rule to make target `all'.  Stop.

But it is from R_HOME/src/gnuwin32.

> I am pretty sure there is an obvious and well documented thing I am missing,
> but missing it I am. Any clues?
>
> Is my problem that I have a Makefile.in but not a Makefile? Have I understood
> section 3.1.3 correctly that no ./configure step is needed? Although my 
> reading
> of the I&A manual is that no ./configure step is needed under Windows, I did
> wonder and tried running
> sh ./configure

You really don't want to do that, and to be sure it did no harm you need 
to unpack R afresh.

> but that failed with
> chmod: not found
> chmod: not found
> chmod: not found
> configure: error: cannot create configure.lineno; rerun with a POSIX shell
>
>
> make is GNU make 3.79.1; I don't know how to identify which sh it is but it is
> the one in the Rtools\bin directory.
>
> I having downloaded all the tools listed in Appendix E (save InnoSetup) and
> installed them and set my path to be:
>
> PATH=c:\Rtools\bin;C:\Perl\bin\;c:\Rtools\MinGW\bin;c:\progra~1\htmhe~1;C:\Progr
> am Files\MiKTeX 
> 2.6\miktex\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System3
> 2\Wbem;C:\Program Files\Subversion\bin
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Question on the R's C stack limit

2007-06-01 Thread Simon Urbanek
On Jun 1, 2007, at 5:44 AM, Ev Whin wrote:

> Dear r-devel members,
> I encountered a C stack limit issue, when I tried to embed R  
> 2.5 into my
> application.

If you are embedding R, you can change or disable the stack limit by  
setting R_CStackLimit appropriately. There is no need to change the R  
source code.

Cheers,
Simon



> In the R-exts document, it says:"Note that R's own front ends
> use a stack size of 10Mb". I desire to know: is it possible to  
> decrease this
> stack size
> by modifying R's source code? If it's possible, which part of the  
> source
> code is responsible for the issue?
>
> Thank you all.
>

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Possible changes to connections

2007-06-01 Thread Stephen B. Weston
Prof Brian Ripley <[EMAIL PROTECTED]> writes:

 > [I know there is a call to getConnection in package gtools, but
 > the return value is unused!]

Speaking of connections and gtools, I've been wondering if the
gtools setTCPNoDelay function's method of getting the Unix file
descriptor of a socket connection is safe.  It's basically doing
this:

   d <- as.integer(socketConnection("localhost", 80)[1])

Is that depending on an implementation detail that may change?
I think it's useful to allow C extensions to set OS specific
socket options on connection objects.  But perhaps Jeffrey
Horner's proposal addresses this need.

- Steve

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Question on the R's C stack limit

2007-06-01 Thread Prof Brian Ripley
On Fri, 1 Jun 2007, Simon Urbanek wrote:

> On Jun 1, 2007, at 5:44 AM, Ev Whin wrote:
>
>> Dear r-devel members,
>> I encountered a C stack limit issue, when I tried to embed R
>> 2.5 into my
>> application.
>
> If you are embedding R, you can change or disable the stack limit by
> setting R_CStackLimit appropriately. There is no need to change the R
> source code.

Ah, you can change or disable R's detection of imminent stack limit 
transgressions.  That does not change the actual stack size.

You may well have guessed right that this question was actually about 
stack limit detection, but that is not what was written.

The point of the comment in the manual is that if you run R embedded in 
another application, R potentially needs a fairly large stack size.  The 1 
or 2Mb default of most Windows' compilers is insufficient, and stack size 
is a parameter in the header of the application, not of the compiled 
R.dll.

>
> Cheers,
> Simon
>
>
>
>> In the R-exts document, it says:"Note that R's own front ends
>> use a stack size of 10Mb". I desire to know: is it possible to
>> decrease this
>> stack size
>> by modifying R's source code? If it's possible, which part of the
>> source
>> code is responsible for the issue?
>>
>> Thank you all.
>>
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] Debug with set.seed()

2007-06-01 Thread Tong Wang
HI, all
I am debugging an R code with dynamically loaded function in it.  It seems 
set.seed(n) does not give me the same 
random draws every time.  Could somebody tell me what I should do to get the 
same outcome verytime ?
I am not sure what infomation is relevent to this question , the following 
is a really scatchy description of the code I wrote.I am using the R-2.4.1 
built under Cygwin. OS is WinXP.

Thanks a lot  for any help.  
  
Myfunction<-function(...) {
...
drawsomething<-function(){  out<- .C( "drawit"...)  
 var <<- out$var  # 
assign the outputs}
...
for( i in 1 : iter) { .
drawsomething()
.. }

   reture( var.stor ) #return stored result
}

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] HTML vignette browser

2007-06-01 Thread Deepayan Sarkar
Hi,

this is tangentially related to the recent discussion on vignettes.
vignette() currently produces a listing of available vignettes, but
these are not clickable. Since R has a browseURL() function, it seems
natural to have a version that produces HTML with clickable links.
Here's an attempt at that:

source("http://dsarkar.fhcrc.org/R/vignette-browser.R";)
browseVignettes()
browseVignettes(package = "grid")

etc. Perhaps some variant of this could be added to R.

Comments welcome.

-Deepayan

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel