[Rd] R CMD check and Suggests Packages

2011-04-28 Thread Dario Strbenac
Hello,

In my description file, I have an example data package in Suggests: that I've 
deleted from my library to test what the user who doesn't have it will 
experience.

However, R CMD check won't even pass my package :

* checking package dependencies ... ERROR
Package required but not available: RepitoolsExamples

Why would it have to be installed, if it's only a data package, that isn't 
needed in any of my code ? The manual also says "In particular, large packages 
providing “only” data for examples or vignettes should be listed in ‘Suggests’ 
rather than ‘Depends’ in order to make lean installations possible."

--
Dario Strbenac
Research Assistant
Cancer Epigenetics
Garvan Institute of Medical Research
Darlinghurst NSW 2010
Australia
__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] error while checking package size during Rcmd check

2011-04-28 Thread Gabor Grothendieck
On Thu, Apr 28, 2011 at 9:01 PM, Gabor Grothendieck
 wrote:
> I am receiving this message during
>  Rcmd check proto-3.9.2.tar.gz
> using "R version 2.13.0 Patched (2011-04-25 r55638)"
>
> * checking installed package size ...Error in if (total > 1024 * 5) { : 
> missing
> value where TRUE/FALSE needed
> Execution halted
>
> I don't get this under R.2.12.x.  The size of the tar.gz file is under
> 600K.  What causes this or if its too hard to tell from the message
> how can I investigate it further?
>

Also I am using Windows Vista; however, I just found that by upgrading
to the latest Rtools the problem disappears.

-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com

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


[Rd] error while checking package size during Rcmd check

2011-04-28 Thread Gabor Grothendieck
I am receiving this message during
  Rcmd check proto-3.9.2.tar.gz
using "R version 2.13.0 Patched (2011-04-25 r55638)"

* checking installed package size ...Error in if (total > 1024 * 5) { : missing
value where TRUE/FALSE needed
Execution halted

I don't get this under R.2.12.x.  The size of the tar.gz file is under
600K.  What causes this or if its too hard to tell from the message
how can I investigate it further?

-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com

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


Re: [Rd] Wish R Core had a standard format (or generic function) for "newdata" objects

2011-04-28 Thread Greg Snow
Another way to see your plots is the TkPredict function in the TeachingDemos 
package.  It will default the variables to their medians for numeric predictors 
and baseline level for factors, but then you can set all of those to something 
more meaningful one time using the controls, then cycle through the predictors 
for the plots.  It can also give you a command line version of the commands 
that you could then run, or loop through to get your plots.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


> -Original Message-
> From: r-devel-boun...@r-project.org [mailto:r-devel-bounces@r-
> project.org] On Behalf Of Paul Johnson
> Sent: Wednesday, April 27, 2011 10:20 AM
> To: Duncan Murdoch
> Cc: R Devel List
> Subject: Re: [Rd] Wish R Core had a standard format (or generic
> function) for "newdata" objects
> 
> On Tue, Apr 26, 2011 at 7:39 PM, Duncan Murdoch
>  wrote:
> 
> > If you don't like the way this was done in my three lines above, or
> by Frank
> > Harrell, or the Zelig group, or John Fox, why don't you do it
> yourself, and
> > get it right this time?  It's pretty rude to complain about things
> that
> > others have given you for free, and demand they do it better.
> >
> > Duncan Murdoch
> >
> 
> I offer sincere apology for sounding that way.  I'm not attacking
> anybody. I'm just talking, asking don't you agree this were
> standardized.  And you disagree, and I respect that since you are
> actually doing the work.
> 
> >From a "lowly user's point of view", I wish "you experts" out there
> would tell us one way to do this, we could follow your example.
> 
> When there's a regression model fitted with 20 variables in it, and
> half of them are numeric, 4 are unordered factors, 3 are ordinal
> factors, and what not, then this is a hard problem for many of us
> ordinary users.  Or it is tedious.  They want "keep everything fixed,"
> except one variable that takes on different specified values.  And
> they want to do that for every variable, one at a time.
> 
> Stata has made this easy for many models, R could as well, if we
> coalesced on a more-or-less standard way to create newdata objects for
> predict.
> 
> But, in the end, I agree with your sentiment.  I just have to do this,
> show you it is handy.  I think Zelig's setx has it about right, I'll
> pursue that strategy.
> 
> pj
> --
> Paul E. Johnson
> Professor, Political Science
> 1541 Lilac Lane, Room 504
> University of Kansas
> 
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

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


[Rd] problems of new cairo device on win32

2011-04-28 Thread Gong Yu
yesterday i send two email about these problems, but I found the attached patch 
is removed, so i post again.

issue 1 :
  the new cairo device depend on gtk2, but gtk for windows is buggy, and cairo 
can be built without gtk2,
so I propose build  cairo without gtk2 using MinGW, so we can reduce the depend.

issue 2 :
  the default font  Helvetica is not an unicode font, so when plots contain 
 East Asia Char, there will be problem, 
I saw today svn commit,  on win32 now use  Arial font but still have CJK 
problem, I think the best way is using 
"Arial Unicode MS" font.

below is  the patch file, : 

Index: src/library/grDevices/src/cairo/cairoBM.c
===
--- src/library/grDevices/src/cairo/cairoBM.c(版本 55681)
+++ src/library/grDevices/src/cairo/cairoBM.c(工作副本)
@@ -25,7 +25,7 @@
 /* This module is only compiled if HAVE_WORKING_CAIRO is true */
 
 #ifdef Win32
-#define HAVE_PANGOCAIRO 1
+#define HAVE_PANGOCAIRO 0
 #define HAVE_CAIRO_SVG 1
 #define HAVE_CAIRO_PDF 1
 #define HAVE_CAIRO_PS 1
Index: src/library/grDevices/src/cairo/cairoBM.h
===
--- src/library/grDevices/src/cairo/cairoBM.h(版本 55681)
+++ src/library/grDevices/src/cairo/cairoBM.h(工作副本)
@@ -39,7 +39,9 @@
 
 
 #include 
-
+#ifdef Win32
+#undef HAVE_PANGOCAIRO
+#endif
 #ifdef HAVE_PANGOCAIRO
 #  include 
 #  include 
Index: src/library/grDevices/src/cairo/cairoX11.c
===
--- src/library/grDevices/src/cairo/cairoX11.c(版本 55681)
+++ src/library/grDevices/src/cairo/cairoX11.c(工作副本)
@@ -465,7 +465,11 @@
 return raster;
 }
 #endif
- 
+
+#ifdef Win32
+ #undef HAVE_PANGOCAIRO  
+#endif
+
 #ifdef HAVE_PANGOCAIRO
 /* - pangocairo section --- */
 
@@ -782,7 +786,11 @@
 pX11Desc xd = (pX11Desc) dd->deviceSpecific;
 int face = gc->fontface;
 double size = gc->cex * gc->ps *fs;
-char *family = "Helvetica";
+#ifdef Win32 
+  char *family = "Arial Unicode MS";
+#else 
+ char *family = "Helvetica";
+#endif
 int slant = CAIRO_FONT_SLANT_NORMAL, wt  = CAIRO_FONT_WEIGHT_NORMAL;
 #ifdef WIN32
 char *times = "Times New Roman", *hv = "Arial";
@@ -792,8 +800,8 @@
 
 char *fm = gc->fontfamily;
 if(streql(fm, "mono")) family = "courier";
-else if(streql(fm, "serif")) family = times
-else if(streql(fm, "sans")) family = hv
+else if(streql(fm, "serif")) family = times;
+else if(streql(fm, "sans")) family = hv;
 else if(fm[0]) family = fm;
 if (face < 1 || face > 5) face = 1;
 if (face == 5) family = "Symbol";
Index: src/library/grDevices/src/cairo/Makefile.win
===
--- src/library/grDevices/src/cairo/Makefile.win(版本 55681)
+++ src/library/grDevices/src/cairo/Makefile.win(工作副本)
@@ -18,15 +18,11 @@
 
 
 PKG_CPPFLAGS=-I$(R_HOME)/src/include -I. -I.. -DHAVE_CONFIG_H  $(arch_DEFS)
-PKG_CPPFLAGS+= -I"$(GTK2_HOME)/include/cairo" \
-  -I"$(GTK2_HOME)/include/pango-1.0" \
-  -I"$(GTK2_HOME)/include/glib-2.0" \
-  -I"$(GTK2_HOME)/lib/glib-2.0/include" \
-  -I"$(GTK2_HOME)/include"
+PKG_CPPFLAGS+= -I"/MinGW/include/cairo" \
 
-PKG_LIBS=-L"$(GTK2_HOME)/lib" -lpangocairo-1.0 -lpango-1.0 -lcairo \
-  -lglib-2.0 -lgobject-2.0
+PKG_LIBS=-L"$(GTK2_HOME)/lib" -lcairo 
 
+
 all: winCairo.dll
 @cp winCairo.dll $(R_HOME)/library/grDevices/libs$(R_ARCH)

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


[Rd] MDX package?

2011-04-28 Thread Kevin Burton
Much of our data is stored in an MDX datawarehouse using SQL 2008. I was
wondering if there has been any work done on interfacing MDX to 'R'?

 

Kevin Burton

rkevinbur...@charter.net


[[alternative HTML version deleted]]

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


Re: [Rd] GPLv2-only code in R?

2011-04-28 Thread Prof Brian Ripley

On Thu, 28 Apr 2011, Duncan Murdoch wrote:


On 27/04/2011 12:55 PM, Brett Smith wrote:

Hello,

I'm sending this to R-devel under the guideline that the ensuing
discussion would probably be unintelligible to people who aren't
programmers.  If that's not right, I apologize.

  says in part: "Some files are
licensed under 'GPL (version 2 or later)', which includes GPL-3. See the
comments in the files to see if this applies."  This implies that there
are files in R that do *not* have the "or later" language, and can only
be used under GPLv2.

I've done some initial searches for files in the R source code that
don't have the "or later" language, but haven't turned anything up yet.
   If anybody knows of any off-hand and could point me to them, I'd
appreciate it.


Package rpart is GPL-2-only in R 2.13.0, but is more liberally licensed in 
R-patched and R-devel.  The survival package was GPL-2-only until R 2.12.1.


And all of this in the COPYRIGHTS file for each version of R.



Duncan Murdoch

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



--
Brian D. Ripley,  rip...@stats.ox.ac.uk
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] GPLv2-only code in R?

2011-04-28 Thread Duncan Murdoch

On 27/04/2011 12:55 PM, Brett Smith wrote:

Hello,

I'm sending this to R-devel under the guideline that the ensuing
discussion would probably be unintelligible to people who aren't
programmers.  If that's not right, I apologize.

  says in part: "Some files are
licensed under 'GPL (version 2 or later)', which includes GPL-3. See the
comments in the files to see if this applies."  This implies that there
are files in R that do *not* have the "or later" language, and can only
be used under GPLv2.

I've done some initial searches for files in the R source code that
don't have the "or later" language, but haven't turned anything up yet.
   If anybody knows of any off-hand and could point me to them, I'd
appreciate it.


Package rpart is GPL-2-only in R 2.13.0, but is more liberally licensed 
in R-patched and R-devel.  The survival package was GPL-2-only until R 
2.12.1.


Duncan Murdoch

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


[Rd] GPLv2-only code in R?

2011-04-28 Thread Brett Smith

Hello,

I'm sending this to R-devel under the guideline that the ensuing 
discussion would probably be unintelligible to people who aren't 
programmers.  If that's not right, I apologize.


 says in part: "Some files are 
licensed under 'GPL (version 2 or later)', which includes GPL-3. See the 
comments in the files to see if this applies."  This implies that there 
are files in R that do *not* have the "or later" language, and can only 
be used under GPLv2.


I've done some initial searches for files in the R source code that 
don't have the "or later" language, but haven't turned anything up yet. 
 If anybody knows of any off-hand and could point me to them, I'd 
appreciate it.


Thank you,

--
Brett Smith
License Compliance Engineer, Free Software Foundation

Support the FSF by becoming an Associate Member: http://fsf.org/jf

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


[Rd] cairo device on win32 without gtk2

2011-04-28 Thread Gong Yu
now  cairo device  work on win32, but  it depends gtk2 for windows and have CJK 
problem.

so I change a litte bit to avoid these two problem.

to apply these two patch, you should build pixman and cairo without gtk2 using 
mingw from source.

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


Re: [Rd] Interrupting C++ code execution

2011-04-28 Thread peterhepperger
Andrew,

> You may like to give CXXR a try 
> (http://www.cs.kent.ac.uk/projects/cxxr/).  In CXXR the R interpreter is 
> written in C++, and a user interrupt is handled by throwing a C++ 
> exception, so the stack is unwound in an orderly fashion, destructors 
> are invoked, etc.
Thank you for this suggestion. CXXR is a very interesting project!

For my current project, however, I aim at distributing the program to
other R users on pre-installed cluster nodes. Thus, I have no choice
with respect to the underlying R interpreter.

Best regards,
Peter

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


[Rd] patch about recent cairo device on win32

2011-04-28 Thread Gong Yu
dear all:

now I am happy with cairo  on win32, but  it depends gtk2 for windows and have 
CJK problem.

so I change a litte bit to avoid this two problem.


to apply those two patch, you should build pixman and cairo without gtk2 using 
mingw from source.

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


[Rd] request for R-exts addition

2011-04-28 Thread Ben Bolker

  would it be possible / make sense to copy some of the information in
?news into the R-exts manual, where package writers are most likely (?)
to look for it?  The information therein seems more appropriate for the
extensions manual ...

  cheers
Ben Bolker

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


Re: [Rd] median and data frames

2011-04-28 Thread S Ellison
This seems trivially fixable using something like

median.data.frame <- function(x, na.rm=FALSE) {
   sapply(x, function(y, na.rm=FALSE) if(is.factor(y)) NA else
median(y, na.rm=na.rm), na.rm=na.rm)
}


>>> Paul Johnson  28/04/2011 06:20 >>>
On Wed, Apr 27, 2011 at 12:44 PM, Patrick Burns
 wrote:
> Here are some data frames:
>
> df3.2 <- data.frame(1:3, 7:9)
> df4.2 <- data.frame(1:4, 7:10)
> df3.3 <- data.frame(1:3, 7:9, 10:12)
> df4.3 <- data.frame(1:4, 7:10, 10:13)
> df3.4 <- data.frame(1:3, 7:9, 10:12, 15:17)
> df4.4 <- data.frame(1:4, 7:10, 10:13, 15:18)
>
> Now here are some commands and their answers:

>> median(df4.4)
> [1]  8.5 11.5
>> median(df3.2[c(1,2,3),])
> [1] 2 8
>> median(df3.2[c(1,3,2),])
> [1]  2 NA
> Warning message:
> In mean.default(X[[2L]], ...) :
>  argument is not numeric or logical: returning NA
>
>
>
> The sessionInfo is below, but it looks
> to me like the present behavior started
> in 2.10.0.
>
> Sometimes it gets the right answer.  I'd
> be grateful to hear how it does that -- I
> can't figure it out.
>

Hello, Pat.

Nice poetry there!  I think I have an actual answer, as opposed to the
usual crap I spew.

I would agree if you said median.data.frame ought to be written to
work columnwise, similar to mean.data.frame.

apply and sapply  always give the correct answer

> apply(df3.3, 2, median)
  X1.3   X7.9 X10.12
 2  8 11

> apply(df3.2, 2, median)
X1.3 X7.9
   28

> apply(df3.2[c(1,3,2),], 2, median)
X1.3 X7.9
   28

mean.data.frame is now implemented as

mean.data.frame <- function(x, ...) sapply(x, mean, ...)

I think we would suggest this for medians:

??

median.data.frame <- function(x,...) sapply(x, median, ...)

?

It works, see:

> median.data.frame(df3.2[c(1,3,2),])
X1.3 X7.9
   28

Would our next step be to enter that somewhere in R bugzilla? (I'm not
joking--I'm that naive).

I think I can explain why the current median works intermittently in
those cases you mention.  Give it a small set of pre-sorted data, all
is well.  median.default uses a sort function, and it is confused when
it is given a data.frame object rather than just a vector.


I put a browser() at the top of median.default

> median(df3.2[c(1,3,2),])
Called from: median.default(df3.2[c(1, 3, 2), ])
Browse[1]> n
debug at #4: if (is.factor(x)) stop("need numeric data")
Browse[2]> n
debug at #4: NULL
Browse[2]> n
debug at #6: if (length(names(x))) names(x) <- NULL
Browse[2]> n
debug at #6: names(x) <- NULL
Browse[2]> n
debug at #8: if (na.rm) x <- x[!is.na(x)] else if (any(is.na(x)))
return(x[FALSE][NA])
Browse[2]> n
debug at #8: if (any(is.na(x))) return(x[FALSE][NA])
Browse[2]> n
debug at #8: NULL
Browse[2]> n
debug at #12: n <- length(x)
Browse[2]> n
debug at #13: if (n == 0L) return(x[FALSE][NA])
Browse[2]> n
debug at #13: NULL
Browse[2]> n
debug at #15: half <- (n + 1L)%/%2L
Browse[2]> n
debug at #16: if (n%%2L == 1L) sort(x, partial = half)[half] else
mean(sort(x,
partial = half + 0L:1L)[half + 0L:1L])
Browse[2]> n
debug at #16: mean(sort(x, partial = half + 0L:1L)[half + 0L:1L])
Browse[2]> n
[1]  2 NA
Warning message:
In mean.default(X[[2L]], ...) :
  argument is not numeric or logical: returning NA


Note the sort there in step 16. I think that's what is killing us.

If you are lucky, give it a small  data frame that is in order, like
df3.2, the sort doesn't produce gibberish. When I get to that point, I
will show you the sort's effect.

First, the case that "works". I moved the browser() down, because I
got tired of looking at the same old not-yet-erroneous output.


> median(df3.2)
Called from: median.default(df3.2)
Browse[1]> n
debug at #15: half <- (n + 1L)%/%2L
Browse[2]> n
debug at #16: if (n%%2L == 1L) sort(x, partial = half)[half] else
mean(sort(x,
partial = half + 0L:1L)[half + 0L:1L])
Browse[2]> n
debug at #16: mean(sort(x, partial = half + 0L:1L)[half + 0L:1L])

Interactively, type

Browse[2]> sort(x, partial = half + 0L:1L)
  NA NA   NA   NA   NA   NA
1  1  7 NULL NULL NULL NULL
2  2  8
3  3  9
Warning message:
In format.data.frame(x, digits = digits, na.encode = FALSE) :
  corrupt data frame: columns will be truncated or padded with NAs

But it still gives you a "right" answer:

Browse[2]> n
[1] 2 8


But if  you give it data out of order, the second column turns to NA,
and that causes doom.


> median(df3.2[c(1,3,2),])
Called from: median.default(df3.2[c(1, 3, 2), ])
Browse[1]> n
debug at #15: half <- (n + 1L)%/%2L
Browse[2]> n
debug at #16: if (n%%2L == 1L) sort(x, partial = half)[half] else
mean(sort(x,
partial = half + 0L:1L)[half + 0L:1L])
Browse[2]> n
debug at #16: mean(sort(x, partial = half + 0L:1L)[half + 0L:1L])

Interactively:

Browse[2]> sort(x, partial = half + 0L:1L)
  NA   NA NA   NA   NA   NA
1  1 NULL  7 NULL NULL NULL
3  3   9   
2  2   8   
Warning message:
In format.data.frame(x, digits = digits, na.encode = FALSE) :
  corrupt data frame: columns will be truncated or padded with NA

Re: [Rd] Interrupting C++ code execution

2011-04-28 Thread Andrew Runnalls

Peter,

On 25/04/11 10:22, schattenpfla...@arcor.de wrote:

1. Calling R_CheckUserInterrupt() interrupts immediately, so I have no
possibility to exit my code gracefully. In particular, I suppose that
objects created on the heap (e.g., STL containers) are not destructed
properly.


Sorry not to have seen this thread sooner.

You may like to give CXXR a try 
(http://www.cs.kent.ac.uk/projects/cxxr/).  In CXXR the R interpreter is 
written in C++, and a user interrupt is handled by throwing a C++ 
exception, so the stack is unwound in an orderly fashion, destructors 
are invoked, etc.


However, it's fair to say that in using CXXR with a multi-threaded 
program you'll be on the bleeding edge...


Andrew

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