[Rd] data.matrix returns mode logical for zero rows (PR#8496)

2006-01-17 Thread jonathan . swinton
Full_Name: Jonathan Swinton
Version: 2.2.1
OS: Windows
Submission from: (NULL) (193.132.159.169)


#The first line of description for data.matrix says that it will
#   'Return the matrix obtained by converting all the variables in a
#data frame to numeric mode and then binding them together as the
# columns of a matrix.'

#However when called with a data.frame with zero rows, data.matrix returns a
matrix 
#of mode logical rather than numeric. This conflicts with the documentation
#and is not what seems sensible.

# One underlying reason for this is that when a zero-length column of a matrix
of mode logical is 
# asserted to be numeric the matrix is not actually cast to numeric. I wonder if
that too is a bug?

> R.version.string
[1] "R version 2.2.1, 2005-12-20"
> df <- data.frame(matrix(1:2,nrow=2))
> mode(data.matrix(df)[,1])
[1] "numeric"
> mode(data.matrix(df[FALSE,])[,1])
[1] "numeric"
> 
> # Underlying cause
> x <- matrix(nr = 2,nc = 1 )
> mode(x)
[1] "logical"
> x[, 1] <-   c(1,2)
> mode(x)
[1] "numeric"
> 
> x0 <- matrix(nr = 0, nc = 1)
> x0[, 1] <-   numeric(0)
> mode(x0)
[1] "logical"
> mode(x0[,1])
[1] "logical"

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


[Rd] Rgui open script file selection filter wish

2007-05-15 Thread Jonathan Swinton

When using the File/Open Script.. dialogue on Windows, the list of filters 
offered is

 R files (*.R)
 S files (*.q,*.ssc,*.S)
 All files (*.*)

I wish that an additional filter be offered as
 Sweave files (*.Rnw,*.Snw)

I find that the Rgui script editor is adequate for most of my R development
and tend to edit *.Rnw files there. 

   _   
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)

__
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


[Rd] Additional file filter for Windows text editor Open/Save dialogues.

2007-10-16 Thread Jonathan Swinton

I propose the following very simple patch to src\gnuwin32\editor.c. Its purpose 
is to allow vignette files, specifically .Snw and .Rnw suffixes, to be an 
available filter in the Open and Save dialogues of the R GUI text editor.

I have successfully built and tested this against R 2.5.0, and found it useful.

Although the patch is against the current r-devel, I cannot currently build 
that (because of a failure to build Rblas.dll, FWIW, and no doubt all my fault 
for not reading the right bit of the manual).
However it seems to me unlikely that this patch would be the victim of such 
version differences, and I think it better to offer it now; I am unlikely to be 
able to troubleshoot my r-devel build for a long time if at all.




Index: editor.c
===
--- editor.c(revision 43174)
+++ editor.c(working copy)
@@ -52,6 +52,9 @@
  static int neditors  = 0;
  static Rboolean fix_editor_up = FALSE;

+/* Definition of available filters for Open and Save dialogues */
+#define EDITORFILEFILTER "R files (*.R)\0*.R\0S files (*.q, *.ssc, 
*.S)\0*.q;*.ssc;*.S\0Vignette files (*.Rnw,*.Snw)\0*.Rnw;*.Snw\0All files 
(*.*)\0*.*\0\0"
+
  static EditorData neweditordata (int file, char *filename)
  {
  EditorData p;
@@ -149,7 +152,7 @@
  EditorData p = getdata(t);
  char *current_name = (p->file ? p->filename : "");
  char *name;
-setuserfilter("R files (*.R)\0*.R\0S files (*.q, *.ssc, 
*.S)\0*.q;*.ssc;*.S\0All files (*.*)\0*.*\0\0");
+setuserfilter( EDITORFILEFILTER);
  name = askfilesave(G_("Save script as"), current_name);
  if (name == NULL)
return;
@@ -337,7 +340,7 @@
  {
  char *name;
  int i; textbox t; EditorData p;
-setuserfilter("R files (*.R)\0*.R\0S files (*.q, *.ssc, 
*.S)\0*.q;*.ssc;*.S\0All files (*.*)\0*.*\0\0");
+setuserfilter(EDITORFILEFILTER);
  name = askfilename("Open script", default_name); /* returns NULL if open 
dialog cancelled */
  if (name) {
/* check if file is already open in an editor. If so, close and open 
again */

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