[Rd] To use breaktodebugger(), which file should I include in C code?

2007-04-25 Thread Tong Wang
Hi, 
I have tried several headers in RHOME/include , but none of them seemed to 
work . 

Thanks for your help.

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


Re: [Rd] To use breaktodebugger(), which file should I include in C code?

2007-04-25 Thread Duncan Murdoch
On 4/25/2007 3:47 AM, Tong Wang wrote:
> Hi, 
> I have tried several headers in RHOME/include , but none of them seemed 
> to work . 
> 
> Thanks for your help.

It's not part of the API, so you can't call it from package code.

But the implementation is very simple in Windows:

void breaktodebugger()
{
 asm("int $3");
}

so you could easily write your own.  I don't know the equivalent for 
other platforms.

Duncan Murdoch

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


[Rd] R-2.5.0 and unlink/wildcards

2007-04-25 Thread Ernest Turro
It seems unlink doesn't work with wildcards in 2.5.0. I've tried  
R-2.5.0 under gnu/linux from source and the Mac binary from att  
research. Example:

 > dir()
[1] "bgx.Rnw" "bgx.pdf" "run.1"
 > unlink("run.*",recursive=T)
 > dir()
[1] "bgx.Rnw" "bgx.pdf" "run.1"
 > unlink("run.1",recursive=T)
 > dir()
[1] "bgx.Rnw" "bgx.pdf"


Cheers,

Ernest

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


Re: [Rd] R-2.5.0 and unlink/wildcards

2007-04-25 Thread Prof Brian Ripley
This is shell-dependent on a Unix-alike, but Sys.glob() should work.  So 
try

unlink(Sys.glob("run.*"), recursive=TRUE)


On Wed, 25 Apr 2007, Ernest Turro wrote:

> It seems unlink doesn't work with wildcards in 2.5.0. I've tried
> R-2.5.0 under gnu/linux from source and the Mac binary from att
> research. Example:
>
> > dir()
> [1] "bgx.Rnw" "bgx.pdf" "run.1"
> > unlink("run.*",recursive=T)
> > dir()
> [1] "bgx.Rnw" "bgx.pdf" "run.1"
> > unlink("run.1",recursive=T)
> > dir()
> [1] "bgx.Rnw" "bgx.pdf"

-- 
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] R-2.5.0 and unlink/wildcards

2007-04-25 Thread Ernest Turro
Thanks, this now works.

I'd just like to mention that Sys.glob() wasn't necessary in 2.4.1  
and this potential requirement should perhaps be mentioned in ?unlink.

Thanks

E

On 25 Apr 2007, at 12:38, Prof Brian Ripley wrote:

> This is shell-dependent on a Unix-alike, but Sys.glob() should  
> work.  So try
>
> unlink(Sys.glob("run.*"), recursive=TRUE)
>
>
> On Wed, 25 Apr 2007, Ernest Turro wrote:
>
>> It seems unlink doesn't work with wildcards in 2.5.0. I've tried
>> R-2.5.0 under gnu/linux from source and the Mac binary from att
>> research. Example:
>>
>> > dir()
>> [1] "bgx.Rnw" "bgx.pdf" "run.1"
>> > unlink("run.*",recursive=T)
>> > dir()
>> [1] "bgx.Rnw" "bgx.pdf" "run.1"
>> > unlink("run.1",recursive=T)
>> > dir()
>> [1] "bgx.Rnw" "bgx.pdf"
>
> -- 
> 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] R-2.5.0 and unlink/wildcards

2007-04-25 Thread Peter Dalgaard
Ernest Turro wrote:
> It seems unlink doesn't work with wildcards in 2.5.0. I've tried  
> R-2.5.0 under gnu/linux from source and the Mac binary from att  
> research. Example:
>
>  > dir()
> [1] "bgx.Rnw" "bgx.pdf" "run.1"
>  > unlink("run.*",recursive=T)
>  > dir()
> [1] "bgx.Rnw" "bgx.pdf" "run.1"
>  > unlink("run.1",recursive=T)
>  > dir()
> [1] "bgx.Rnw" "bgx.pdf"
>
>   
Yes. The argument is now passed through shQuote, and that has the side
effect of removing wildcard expansions. If this was intentional, someone
forgot to change the help page...

Presumably, the change was done to prevent issues with embedded spaces:
unlink("Program Files") would otherwise delete "Program" and "Files". It
is not obvious to me how this can be achieved  while retaining wildcard
expansion.

-- 
   O__   Peter Dalgaard Ă˜ster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

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


Re: [Rd] R-2.5.0 and unlink/wildcards

2007-04-25 Thread Prof Brian Ripley
On Wed, 25 Apr 2007, Peter Dalgaard wrote:

> Ernest Turro wrote:
>> It seems unlink doesn't work with wildcards in 2.5.0. I've tried
>> R-2.5.0 under gnu/linux from source and the Mac binary from att
>> research. Example:
>>
>> > dir()
>> [1] "bgx.Rnw" "bgx.pdf" "run.1"
>> > unlink("run.*",recursive=T)
>> > dir()
>> [1] "bgx.Rnw" "bgx.pdf" "run.1"
>> > unlink("run.1",recursive=T)
>> > dir()
>> [1] "bgx.Rnw" "bgx.pdf"
>>
>>
> Yes. The argument is now passed through shQuote, and that has the side
> effect of removing wildcard expansions. If this was intentional, someone
> forgot to change the help page...
>
> Presumably, the change was done to prevent issues with embedded spaces:

NEWS says:

 o  unlink() on Unix-alikes failed for paths containing spaces.

> unlink("Program Files") would otherwise delete "Program" and "Files". It
> is not obvious to me how this can be achieved  while retaining wildcard
> expansion.

By using Sys.glob(), but it never got done and no one using pre-2.5.0 
reported this so presumably few people use it.  I'll put a fix in 2.5.0 
patched shortly.

There is the following comment in the R source file

##--- The following should/could really be done in C [platform !] :
unlink <- function(x, recursive = FALSE) {

and that would be a better idea (the Windows version is in C).

-- 
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] [R] Coercing data types for use in model.frame

2007-04-25 Thread Prof Brian Ripley
Moved to R-devel 

What is the 'data class'?  In particular what is its underlying type? And 
where in model.frame[.default] are you trying to use it (in the formula, 
data, in ..., etc).

This is an example of where some reproducible code and the error messages 
would be very helpful indeed.

Brian

On Tue, 24 Apr 2007, Frank E Harrell Jr wrote:

> In the Hmisc package there is a new data class 'mChoice' for multiple
> choice variables.  There are format and as.numeric methods (the latter
> creates a matrix of dummy variables).  mChoice variables are not allowed
> by model.frame.  Is there a way to specify a conversion function that
> model.frame will use automatically?  I would use as.factor here.
> model.frame does not seem to use as.data.frame.foo for individual variables.
>
> Thanks
> Frank
>

-- 
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] [R] Coercing data types for use in model.frame

2007-04-25 Thread Frank E Harrell Jr
Prof Brian Ripley wrote:
> Moved to R-devel 
> 
> What is the 'data class'?  In particular what is its underlying type? 
> And where in model.frame[.default] are you trying to use it (in the 
> formula, data, in ..., etc).
> 
> This is an example of where some reproducible code and the error 
> messages would be very helpful indeed.
> 
> Brian

Brian,

Sorry - this was one of those "too late in the day" errors.  The problem 
was in a function called just before model.frame.  model.frame seems to 
work fine with an object of class c('mChoice', 'labelled').  It keeps 
mChoice variables as mChoice.  After model.frame is finished I'll change 
such variables to factors or matrices.

Frank


> 
> On Tue, 24 Apr 2007, Frank E Harrell Jr wrote:
> 
>> In the Hmisc package there is a new data class 'mChoice' for multiple
>> choice variables.  There are format and as.numeric methods (the latter
>> creates a matrix of dummy variables).  mChoice variables are not allowed
>> by model.frame.  Is there a way to specify a conversion function that
>> model.frame will use automatically?  I would use as.factor here.
>> model.frame does not seem to use as.data.frame.foo for individual 
>> variables.
>>
>> Thanks
>> Frank
>>
> 


-- 
Frank E Harrell Jr   Professor and Chair   School of Medicine
  Department of Biostatistics   Vanderbilt University

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


[Rd] identify() and metafile copies under Windows XP (PR#9634)

2007-04-25 Thread jgvcqa
I am running R version as follows under Windows XP.


platform   i386-pc-mingw32 
arch   i386
os mingw32 
system i386, mingw32   
status 
major  2   
minor  5.0 
year   2007
month  04  
day23  
svn rev41293   
language   R   
version.string R version 2.5.0 (2007-04-23)


Consider the following R commands and comments

x<-1:10
plot(x)
identify(x,n=1) 
# I click under the 4th data point (and "4" appears on the graph). I
save as a Metafile and paste into Word. The original plot and "4" are
copied. This is good.

identify(x) 
# I click under the 5th data point (and "5" also now appears on the
graph) and then use the Esc key to stop the processing. I save as a
Metafile and paste into Word. The original plot and "4" are copied, but
"5" is not copied. This is not good.

identify(x,n=1) 
# I click under the 6th data point. I save as a Metafile and paste into
Word. The original plot and "4" and "6" are copied, but "5" is not
copied


If I save as a bitmap the "5" is also copied.

The same problem occurred in 2.4.0.

Regards,

Joseph G. Voelkel, Ph.D.
Associate Professor and Chair, Graduate Statistics Program
Center for Quality and Applied Statistics
Kate Gleason College of Engineering
Rochester Institute of Technology
V 585-475-2231
F 585-475-5959
[EMAIL PROTECTED]

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


[Rd] R-exts.texi typo

2007-04-25 Thread Jeffrey Horner
Index: doc/manual/R-exts.texi
===
--- doc/manual/R-exts.texi  (revision 41314)
+++ doc/manual/R-exts.texi  (working copy)
@@ -8951,7 +8951,7 @@
  @deftypefun int R_ReadConsole (char [EMAIL PROTECTED], unsigned char 
[EMAIL PROTECTED], @
int @var{buflen}, int @var{hist})
  @deftypefunx void R_WriteConsole (char [EMAIL PROTECTED], int @var{buflen})
[EMAIL PROTECTED] void R_WriteConsole (char [EMAIL PROTECTED], int 
@var{buflen}, 
int @var{otype})
[EMAIL PROTECTED] void R_WriteConsoleEx (char [EMAIL PROTECTED], int 
@var{buflen}, 
int @var{otype})
  @deftypefunx void R_ResetConsole ()
  @deftypefunx void R_FlushConsole ()
  @deftypefunx void R_ClearErrConsole ()

Jeff
-- 
http://biostat.mc.vanderbilt.edu/JeffreyHorner

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


Re: [Rd] identify() and metafile copies under Windows XP (PR#9634)

2007-04-25 Thread ripley
This seems not specific to metafiles, nor even to Windows (but the use of 
Esc is specific to Rgui).  As I understand it you expected the results of 
a graphics operation you interrupted to be copied.

I don't see anything on the help page explaining what happens if you 
interrupt during identify(), so in the words of the POSIX standards I 
would expect this to be 'undefined'.  The help page does explain how to 
terminate an identify() call, and what puzzles me is why you did not do as 
it suggests.

What a 'copy' means depends on the 'from' and 'to' devices, and how you 
copy.  It seems reasonable that saving a bitmap might be different from 
copying the plot to a device at a different resolution.


On Wed, 25 Apr 2007, [EMAIL PROTECTED] wrote:

> I am running R version as follows under Windows XP.
>
>
> platform   i386-pc-mingw32
> arch   i386
> os mingw32
> system i386, mingw32
> status
> major  2
> minor  5.0
> year   2007
> month  04
> day23
> svn rev41293
> language   R
> version.string R version 2.5.0 (2007-04-23)
>
>
> Consider the following R commands and comments
>
> x<-1:10
> plot(x)
> identify(x,n=1)
> # I click under the 4th data point (and "4" appears on the graph). I
> save as a Metafile and paste into Word. The original plot and "4" are
> copied. This is good.
>
> identify(x)
> # I click under the 5th data point (and "5" also now appears on the
> graph) and then use the Esc key to stop the processing. I save as a
> Metafile and paste into Word. The original plot and "4" are copied, but
> "5" is not copied. This is not good.

But as no point was returned to the console, why did you think it has been 
successfully marked?

> identify(x,n=1)
> # I click under the 6th data point. I save as a Metafile and paste into
> Word. The original plot and "4" and "6" are copied, but "5" is not
> copied
>
>
> If I save as a bitmap the "5" is also copied.
>
> The same problem occurred in 2.4.0.
>
> Regards,
>
> Joseph G. Voelkel, Ph.D.
> Associate Professor and Chair, Graduate Statistics Program
> Center for Quality and Applied Statistics
> Kate Gleason College of Engineering
> Rochester Institute of Technology
> V 585-475-2231
> F 585-475-5959
> [EMAIL PROTECTED]
>
> __
> 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