Re: [Rd] Fetching Warning Messages
Did you get my reply to you on Aug 13 on withCallingHandlers()? https://stat.ethz.ch/pipermail/r-devel/2005-August/034189.html /Henrik Nikhil Shah wrote: > Hi, > > I read the help page and saw that warnings() actually prints the warning > message and stores warning in top-level variable "last.warning". So it seems > that it is almost impossible to access last warning from java code. I got > another solution of fetching warning messages by storing warning messages in > a file and reading the file later. This can be done by using sink() command, > but before that options(warn=1) must be set. > > >>Please read the help page on options("warn") and see what warnings() >>does. (I am pretty sure you have asked this and been told before.) >> >>There should not be an object called last.warning in your example. >> > > > I read help page > > >>On Mon, 22 Aug 2005, Nikhil Shah wrote: >> >> >>>Hi, >>> >>> I am facing one problem of fetching R warning messages in Java Code >>>using Rserve. It is easier to trap R Error messages by using catching >>>RSrvException. I came to know one way of fetching R Warning messages, > > i.e. > >>>using "withCallingHandlers", below is my Java Program, which uses >>>withCallingHandlers of R : >>>import org.rosuda.JRclient.*; >>> >>>---RWarning.java--- >>>class RWarning >>>{ >>> public static void main(String args[]) >>> { >>>try >>>{ >>> String hostName = null; >>> hostName = args[0]; >>> Rconnection c = new Rconnection(hostName); >>> c.voidEval("lastWarning <- NULL"); >>> c.voidEval("withCallingHandlers( >>>{x<-sqrt(-9);y<-matrix(1:9,ncol=4);z<-sqrt(4)} , warning = function (w) > > { > >>>lastWarning <<- paste(lastWarning,as.character(w))})"); //This will > > generate > >>>warning message[sqrt(-9)], another warning message [ > > matrix(1:9,ncol=4) ] > >>>and successful completion [ sqrt(4) ] >>> System.out.println(c.eval("z").asDouble()); >>> System.out.println(c.eval("lastWarning").asString()); >>> c.close(); >>> System.out.println("DONE"); >>> } >>> catch(RSrvException e) >>> { >>>System.out.println("Error : " + e.getMessage()); >>>e.printStackTrace(); >>> } >>> } >>>} >>>---End Of RWarning.java--- >>> >>>Output of above program is (as expected) : >>> >>>2.0 >>>simpleWarning in sqrt(-9): NaNs produced >>>simpleWarning: data length [9] is not a sub-multiple or multiple of the >>>number of columns [4] in matrix >>> >>>DONE >>> >>> >>> >>>Now my query is that if there is any way of using warnings() > > function > >>>in Java Program to fetch all warnings. I used it in my program but > > returns > >>>me NULL instead of warning messages. I also used last.warning but it > > Java > >>>Program gives an error saying that last.warning object is not found. I > > have > >>>pasted both the java code below : >>> >>>This is the java program that I have written to use "last.warning" > > object of > >>>R. Please explain me where the error could be. >>> >>>Code of RWarning1.java >>> >>>import org.rosuda.JRclient.*; >>> >>>class RWarning1 >>>{ >>> public static void main(String args[]) >>> { >>> try >>> { >>> String hostName = null; >>> hostName = args[0]; >>> Rconnection c = new Rconnection(hostName); >>> System.out.println(c.eval("x<-sqrt(-9)").asString()); >>> System.out.println(c.eval("last.warning").asString()); >>> c.close(); >>> System.out.println("DONE"); >>> } >>> catch(RSrvException e) >>> { >>> System.out.println("Error : " + e.getMessage()); >>> e.printStackTrace(); >>> } >>> } >>>} >>>End of code of RWarning1.java-- >>> >>>output of RWarning1.class >>> >>>null >>>Error : Request return code: 127 [request status: Error (127)] >>>org.rosuda.JRclient.RSrvException: Request return code: 127 [request > > status: > >>>Err >>>or (127)] >>> at org.rosuda.JRclient.Rconnection.eval(Rconnection.java:190) >>> at RWarning.main(RWarning.java:13) >>> >>>In other words, when I use "last.warning" in eval method, I simply get > > an > >>>exception, instead of value of last.warning. >>> >>> >>>Below is the java code of using warnings() function. >>> >>>Code of RWarning2.java >>> >>>import org.rosuda.JRclient.*; >>> >>>class RWarning2 >>>{ >>> public static void main(String args[]) >>> { >>> try >>> { >>> String hostName = null; >>> hostName = args[0]; >>> Rconnection c = new Rconnection(hostName); >>> System.out.println(c.eval("x<-sqrt(-9)").asString()); >>> >>> > > System.out.println(c.eval("paste(capture.output(warnings()),collapse='\n')") > >>>.asString()); >>> c.close(); >>> System.out.println("DONE"); >>> } >>> catch(RSrvException e) >>> { >>> System.out.println("Error : " + e.getMessage()); >>> e.printStackTrace(); >>>
Re: [Rd] IPC
Nigel Sim wrote: > Hi, I need to somehow make R communicate with another remote JAVA > process which provides compute services. I have control over the > communications protocol, but I would like to keep it to a standardised > protocol, such as SOAP, CORBA, etc. > > What I would like to know is, what do other people use to do this? The > nature of the communications will be low bandwidth procedure calls, with > little data. (The data is stored in a DBMS). To date I have tried the > RCORBA and SSOAP packages. Corba I couldn't get to compile, and soap I > couldn't get to talk properly to soapanywhere (the embedded soap > implementation I am trialing). Can you let me know what went wrong with SSOAP? It would be good to fix this and I am about to turn my attention to it anyway. As for the "RCORBA" package - what precisely are you referring to? I don't think there is a package named RCORBA, perhaps you mean RSCORBA. If so, yes it is quite old. It can be updated and indeed I have a plan that I might connect it to Orbit. But if RSCORBA didn't compile, you might want to mention which CORBA implementation you were trying to use: it was setup to use 3. As for what people typically use to connect to Java. There is Rserve. There is RSJava. I think your desire to use a standard protocol is a very good one. There are far too many ad hoc solutions that don't do have limited functionality, such as callbacks. On Windows, DCOM client and server and event packages are available. And there are MPI or PVM packages which implement a form of IPC. Do you absolutely need to have a middle-tier of going through the server to get to the DBMS? It is often a good design, but if you can go straight to the DBMS, then that would be esier and more efficient. Please let me know what went wrong with the SSOAP package. D. > > I'm sure with persistence I can get both working, but I would like to > hear others experiences before I invest the time. > > Thank you for your time. > -- > Nigel Sim > > PhD Candidate > School of Mathematics and Physical Sciences > James Cook University > +61 7 4781 4247 > +61 409 277 641 > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel -- Duncan Temple Lang[EMAIL PROTECTED] Department of Statistics work: (530) 752-4782 371 Kerr Hall fax: (530) 752-7099 One Shields Ave. University of California at Davis Davis, CA 95616, USA pgpnTmqaJDzpK.pgp Description: PGP signature __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] IPC
Sean O'Riordain wrote: > for very low bandwidth IPC I'd just use a standard web page form using > a GET... so all you have to do is call a URL with the parameters > embedded in the URL, e.g. > > http://silly.name.for.server.com/javaServlet?a=42&b=394&c=1982&d=complex > > If your bandwidth requirements are a bit higher then you have to start > using POST which is a bit more complicated though... so at that stage > I might use SOAP. POST is not equivalent to SOAP. SOAP uses POST. In order to avoid all the details dealing with HTTP requests such as escaping characters, SSL, passwords, POST/GET, etc., it is simplest to use something that already takes care of these. The RCurl package (www.omegahat.org/RCurl) is in interface libcurl which takes care of so many of these details. httpRequest (regular CRAN package) is implemented entirely within R, but doesn't handle as many of these extra details. D. > > cheers! > Sean > > On 21/08/05, Nigel Sim <[EMAIL PROTECTED]> wrote: > > Hi, I need to somehow make R communicate with another remote JAVA > > process which provides compute services. I have control over the > > communications protocol, but I would like to keep it to a standardised > > protocol, such as SOAP, CORBA, etc. > > > > What I would like to know is, what do other people use to do this? The > > nature of the communications will be low bandwidth procedure calls, with > > little data. (The data is stored in a DBMS). To date I have tried the > > RCORBA and SSOAP packages. Corba I couldn't get to compile, and soap I > > couldn't get to talk properly to soapanywhere (the embedded soap > > implementation I am trialing). > > > > I'm sure with persistence I can get both working, but I would like to > > hear others experiences before I invest the time. > > > > Thank you for your time. > > -- > > Nigel Sim > > > > PhD Candidate > > School of Mathematics and Physical Sciences > > James Cook University > > +61 7 4781 4247 > > +61 409 277 641 > > > > __ > > 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 -- Duncan Temple Lang[EMAIL PROTECTED] Department of Statistics work: (530) 752-4782 371 Kerr Hall fax: (530) 752-7099 One Shields Ave. University of California at Davis Davis, CA 95616, USA pgpnvcFfq4kgD.pgp Description: PGP signature __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] do.call(): no need for quote {was .. Questions about calls..}
> "Gabor" == Gabor Grothendieck <[EMAIL PROTECTED]> > on Mon, 22 Aug 2005 18:55:38 -0400 writes: .. Gabor> Try do.call like this: Gabor> ff <- x ~ g*h Gabor> do.call("substitute", list(ff, list(x = as.name("weight" Just a small remark: For all those who -- like me -- have found it ``unpleasant'' to have to quote the first argument of do.call(): You don't have to any longer since the NEWS of R 2.1.0 contains o do.call() now takes either a function or a character string as its first argument. The supplied arguments can optionally be quoted. So the above could be do.call(substitute, list(ff, list(x = as.name("weight" -- Martin __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Functions with the same name: best practices
hadley wickham wrote: > Ok, here's another best practices question - let's say I'm writing a > package and I want to use a function name that is already claimed by a > function in the base R packages. For the sake of argument, let's > pretend this function is for profiling the performance of a function > (like Rprof for example), and so an obvious name that comes to mind is > profile. This, of course, clashes with the built in profile for > "investigating behavior of objective function near the solution > represented by fitted." > > A little thinking and a quick survey of other packages reveal some > possible solutions: > > * capitalise the function differently (eg. Profile) > * use a prefix/suffic (eg. Rprof) > * use a thesaurus > * use namespaces (and rely on others to use namespaces correctly in > their code/packages) > > What would you suggest? You should use a namespace. It will protect your code against someone else using one of your function names. If the function is for internal use only, that's sufficient. If you want to export the function, you should try to avoid conflicting with existing functions that you expect users to have installed, because it becomes quite inconvenient to users: their scripts depend on the load order of packages unless they put :: in front of each call. I think using a thesaurus would be best (if by that you mean choosing a different name that still describes the function), but will often fail, in which case I'd use the prefix/suffix decoration. Changing only capitalization makes it nearly impossible to talk about your function without confusion. Duncan Murdoch __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] TCITex and R
[EMAIL PROTECTED] wrote: > Several times my packages have fallen foul of the latex check at the > uploading-to-CRAN stage, creating extra work for Kurt Hornik. I've never > bothered trying to get latex working on my own packages (happy with > vanilla help) but am told that "latex is the closest thing to a syntax > checker for Rd files" and that I should set it up. Now, there is already > a latex on my (Windows XP) system thanks to the program Scientific Word, > which comes with TCITex. However, RCMD etc don't recognize this latex at > the moment. Does anyone have any advice on what might be needed to make > RCMD use SciWord's installation of TCITex-- paths, environment > variables, etc etc? I have no experience with TCITex, but what you need to do is make sure the commands that R needs are on your path. Those include "latex", "pdflatex", and possibly others I've forgotten: try building a binary copy of your package and you'll get errors if you haven't got them in place. You also need that TCITex follows the usual practice of using an environment variable to accept additional directories to search. MikTex doesn't, and it causes lots of trouble for people. This is the main reason I haven't recommended MikTex over fptex even though I use it; MikTex seems less stable about its interface. Duncan Murdoch > > Various R docs recommend fptex or MikTex implementations of latex, but > I'm a bit reluctant to put these on, primarily in case doing so somehow > stuffs up the workings of Scientific Word in a way that I don't know > enough to fix. In case it's not obvious already, I should add that I am > blissfully ignorant about how latex works-- that's one of my reasons for > using Scientific Word. > > Thanks for any advice > > Mark > > Mark Bravington > CSIRO Mathematical & Information Sciences > Marine Laboratory > Castray Esplanade > Hobart 7001 > TAS > > ph (+61) 3 6232 5118 > fax (+61) 3 6232 5012 > mob (+61) 438 315 623 > > __ > 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] Which TEX for Wiindows
I am intending to instal TEX (for use with R - building, checking packages) on my WinXP SP2. I read that fptex is recomended, however http://www.fptex.org/ is not not available. Is MiKTeX the next best choice? Thanks in advance for any suggestions! Ales Ziberna __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] do.call(): no need for quote {was .. Questions about calls..}
On 8/23/05, Martin Maechler <[EMAIL PROTECTED]> wrote: > > "Gabor" == Gabor Grothendieck <[EMAIL PROTECTED]> > > on Mon, 22 Aug 2005 18:55:38 -0400 writes: > > .. > >Gabor> Try do.call like this: > >Gabor> ff <- x ~ g*h >Gabor> do.call("substitute", list(ff, list(x = as.name("weight" > > Just a small remark: For all those who -- like me -- have found > it ``unpleasant'' to have to quote the first argument of do.call(): > You don't have to any longer since the NEWS of R 2.1.0 contains > >o do.call() now takes either a function or a character string as >its first argument. The supplied arguments can optionally be >quoted. > > So the above could be > > do.call(substitute, list(ff, list(x = as.name("weight" I have used that form but went back to the character form when I noticed the entire text of the function appearing in tracebacks, which I found to be a nuisance, particularly for functions with large bodies: > f <- function(x) { stop() } > do.call(f, list(3)) Error in function (x) : > traceback() 3: stop() 2: function (x) { stop() }(3) 1: do.call(f, list(3)) Of course, in the case of substitute the body is only one line. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Which TEX for Wiindows
On Tue, 23 Aug 2005, Ales Ziberna wrote: > I am intending to instal TEX (for use with R - building, checking packages) > on my WinXP SP2. I read that fptex is recomended, however > http://www.fptex.org/ is not not available. Is MiKTeX the next best choice? Please look at the current documentation: The @code{fptex} distribution of @LaTeX{} (directly from any CTAN node such as @url{http://www.ctan.org/tex-archive/systems/windows/fptex/} or via XEmTeX at @url{http://www.fptex.org}) includes a suitable port of @code{pdftex}. (www.fptex.org was available until very recently.) -- 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] Which TEX for Wiindows
On 8/23/05, Ales Ziberna <[EMAIL PROTECTED]> wrote: > I am intending to instal TEX (for use with R - building, checking packages) > on my WinXP SP2. I read that fptex is recomended, however > http://www.fptex.org/ is not not available. Is MiKTeX the next best choice? > Yes. Be sure to read: http://www.murdoch-sutherland.com/Rtools/miktex.html __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] About R variable references
Hi Markku. You have correctly diagnosed the problem that the initially set global variables "are not stable". In your call to myinit, you store a C-level reference to the var and func R objects. But you need to tell R's memory management that you need to hold onto them. Otherwise it is entitled to garbage collect them as it feels fit. In the C-code for myinit, you might add calls R_PreserveObject(myfunction) R_PreserveObject(myvariable) that is defined in Rinternals.h. These go after you assign values to your global variables. You are PROTECT()'ing these variables only in the call to myexec. D. Markku Mielityinen wrote: > Hello Group, > > I could use an advice on how SEXP handles work. My aim is to implement a > system where I initially set a few global variables that are used for > communication between C and R code. Then I do some work with R code and > periodically call a function of my own that will update the system > state. Such a design is useful for many purposes (for GUIs to name one). > I am not entirely sure that R can handle such a design but at the moment > I cannot see any reasons why it could not. The problem I have is that > the initially set global variables are not stable. Everything works for > a while but eventually the system gets confused. It seems that the SEXP > references to the state variables and to the callback functions may get > altered and become pointing to some other variables. This will then > rightfully give me the error messages like "attempt to apply > non-function". My (maybe uneducated) guess is that this might have > something to do with R memory management. The variables are connected to > the namespace so a do not think they are removed. Maybe they are moved > is such a way that my SEXP references are not able to follow. As you can > see I am on thin ice here so please feel welcome to step in... > > My librtary contains ~20k lines of C code so I would not consider a bug > here out of the question. I have tried to look for one but until now > without success. > > My question is: can you see a design flaw here or is everything done > according to R requirements and hence it is likely that there is a bug > in my own code? > > One dirty correction I can see but have not tried is to use object names > and findVar but this would make it less flexible (at least IMHO). > > I have quickly browsed the forums and the documentation I was able to > find but found no answers. > > My system is FC3 with R version >= 2. > > There are two snippets of code that hopefully make clear what I am > trying to achieve. The code is provided for illustration purposes only > and I did not try to compile it. > > Best regards, > Markku Mielityinen > > > # C CODE > # > > SEXP myrho = R_GlobalEnv; > SEXP myvariable = R_NilValue; > SEXP myfunction = R_NilValue; > > SEXP myinit(SEXP var, SEXP func) { > myvariable = var; > myfunction = func; > return R_NilValue; > } > > SEXP myexec(/* probably has some parameters that are omitted in this > example */) { > int state; > SEXP thecall; > > /* do some work, then set the state and call a callback function > if necessary */ > > PROTECT(myvariable); > INTEGER(myvariable)[0] = state; > UNPROTECT(1); > if(state) { > PROTECT(thecall = LCONS(myfunction, LCONS(myvariable, > R_NilValue))); > eval(thecall, myrho); > UNPROTECT(1); > } > > return R_NilValue; > } > > > > > # R CODE > # > > myinit<-function(var,func) .Call("myinit",var,func) > myexec<-function() .Call("myexec") > > state<-as.integer(1) > callback<-function(state) { cat(sprintf("You got state %s\n",state)) } > > myinit() > # do some work here and call myexec() periodically... > > > > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel -- Duncan Temple Lang[EMAIL PROTECTED] Department of Statistics work: (530) 752-4782 371 Kerr Hall fax: (530) 752-7099 One Shields Ave. University of California at Davis Davis, CA 95616, USA pgpeto7wdENhY.pgp Description: PGP signature __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] weigths in boxplot
> "Erich" == Erich Neuwirth <[EMAIL PROTECTED]> > on Sun, 21 Aug 2005 18:51:20 +0200 writes: Erich> In R 2.2.0 density now can work with weighted Erich> obesrvations. It would be nice if boxplot also would Erich> accept a weight parameter, then one could produce Erich> consistent density estimators and boxplots. Erich> Could the developers consider adding this feature? The first thing I'd want is quantile() with weights --- which I personally find quite interesting and have wanted several times in the past --- not wanted enough to implement though. I'm interested to hear of (or even see C or R implementations of) fast algorithms for "weight quantiles". Code contributions are welcome too.. (And yes, I do know that boxplots are base on "hinges" rather than quartiles but that's less interesting here.) Martin Maechler <[EMAIL PROTECTED]> http://stat.ethz.ch/~maechler/ Seminar fuer Statistik, ETH-Zentrum LEO C16Leonhardstr. 27 ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND phone: +41-44-632-3408 fax: ...-1228 <>< __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] NAs by integer overflow in Spearman's test p-value (PR#8087)
Full_Name: Jan T. Kim Version: 2.1.0 (and better) OS: Linux Submission from: (NULL) (139.222.3.229) The p value in Spearman's test is NA if the length of x exceeds 46340, due to an integer overflow, occurring if length(n) > sqrt(2^31): > n <- 46341; > set.seed(1); > x <- runif(n); > y <- runif(n); > cor.test(x, y, method = "spearman"); Spearman's rank correlation rho data: x and y S = 1.654965e+13, p-value = NA alternative hypothesis: true rho is not equal to 0 sample estimates: rho 0.002199426 Warning message: NAs produced by integer overflow in: n * n The integer overflow occurs in src/library/stats/R/cor.test.R, and it can be fixed by converting n to double appropriately (see *** fix label ***, lines 110 onwards are shown): ## Use the test statistic S = sum(rank(x) - rank(y))^2 ## and AS 89 for obtaining better p-values than via the ## simple normal approximation. ## In the case of no ties, S = (1-rho) * (n^3-n)/6. pspearman <- function(q, n, lower.tail = TRUE) { if(n <= 1290) # n*(n^2 - 1) does not overflow .C("prho", as.integer(n), as.double(q + 1), p = double(1), integer(1), as.logical(lower.tail), PACKAGE = "stats")$p else { # for large n: aymptotic t_{n-2} n <- as.double(n); # *** fix *** r <- 1 - 6 * q / (n*(n*n - 1)) pt(r / sqrt((1 - r^2)/(n-2)), df = n-2, lower.tail= !lower.tail) } } q <- round((n^3 - n) * (1 - r) / 6) STATISTIC <- c(S = q) PVAL <- switch(alternative, "two.sided" = { p <- if(q > (n^3 - n) / 6) pspearman(q - 1, n, lower.tail = FALSE) else pspearman(q, n, lower.tail = TRUE) min(2 * p, 1) }, "greater" = pspearman(q, n, lower.tail = TRUE), "less" = pspearman(q - 1, n, lower.tail = FALSE)) if(TIES) warning("p-values may be incorrect due to ties") Inserting the typecast only in the pspearman function is a minimally invasive fix -- alternatively, replacing at line 17 n <- length(x) with n <- as.double(length(x)) achieves the same fix and may take care of other unnecessary integer overflows, but it may also introduce new problems e.g. in .C calls etc. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] compile R with Portland Group compiler
Hi, Can anyone advise me on how to compile R with Portland Group compiler on a Opeteron machine with Red Hat Enterprise Linux WS release 4 installed? I've edit config.site file to pick portland group compilers instead of gcc. Here is the list of modified flags: CC=/usr/pgi/linux86-64/6.0/bin/pgcc CFLAGS='-g -O2' CPPFLAGS='-I/usr/pgi/linux86-64/6.0/include -I/usr/pgi/linux86-64/6.0/include/CC' F77=/usr/pgi/linux86-64/6.0/bin/pgf77 FLAGS='-O2' CPICFLAGS=-fPIC FPICFLAGS=-fPIC SHLIB_LDFLAGS=-shared LDFLAGS='-L/usr/pgi/linux86-64/6.0/lib -L/usr/lib64' CXX=/usr/pgi/linux86-64/6.0/bin/pgCC CXXPICFLAGS=-fPIC SHLIB_CXXLDFLAGS=-shared When I ran configure, I didn't get any error message, but config.log indicated there are errors, configure:4102: $? = 0 configure:4124: result: o configure:4128: checking whether we are using the GNU C compiler configure:4152: /usr/pgi/linux86-64/6.0/bin/pgcc -c -g -O2 -I/usr/pgi/linux86-64/6.0/include -I/usr/pgi/linux86-64/6.0/include/C\ C conftest.c >&5 PGC-S-0040-Illegal use of symbol, choke (conftest.c: 21) PGC/x86-64 Linux/x86-64 6.0-5: compilation completed with severe errors configure:4158: $? = 2 configure: failed program was: | /* confdefs.h. */ | | #define PACKAGE_NAME "R" | #define PACKAGE_TARNAME "R" | #define PACKAGE_VERSION "2.1.1" | #define PACKAGE_STRING "R 2.1.1" | #define PACKAGE_BUGREPORT "[EMAIL PROTECTED]" | #define PACKAGE "R" | #define VERSION "2.1.1" | #define R_PLATFORM "x86_64-unknown-linux-gnu" | #define R_CPU "x86_64" | #define R_VENDOR "unknown" | #define R_OS "linux-gnu" | #define Unix 1 | /* end confdefs.h. */ | | int | main () | { | #ifndef __GNUC__ |choke me | #endif | | ; | return 0; | } configure:4184: result: no configure:4190: checking whether /usr/pgi/linux86-64/6.0/bin/pgcc accepts -g If I ignored the config.log errors and went ahead to do make, I got the following errors, make[3]: Entering directory `/home/cuser/AMD_BENCH/R-2.1.1/src/main' /usr/pgi/linux86-64/6.0/bin/pgcc -I../../src/extra/zlib -I../../src/extra/bzip2 -I../../src/extra/pcre -I. -I../../src/include -I../../src/include -I/usr/pgi/linux86-64/6.0/include -I/usr/pgi/linux86-64/6.0/include/CC -DHAVE_CONFIG_H -g -O2 -c regex.c -o regex.o PGC-W-0155-64-bit integral value truncated (/usr/include/wctype.h: 109) PGC-W-0155-64-bit integral value truncated (/usr/include/wctype.h: 110) PGC-W-0155-64-bit integral value truncated (/usr/include/wctype.h: 111) PGC-W-0155-64-bit integral value truncated (/usr/include/wctype.h: 112) PGC-W-0084-Type of old-style argument src does not match type of prototype argument src (regex.c: 743) PGC-S-0043-Redefinition of symbol, bitset_merge (regex.c: 743) PGC-S-0100-Non-integral operand for mod, shift, or bitwise operator (regex.c: 746) PGC-W-0084-Type of old-style argument src does not match type of prototype argument src (regex.c: 753) PGC-S-0043-Redefinition of symbol, bitset_not_merge (regex.c: 753) PGC-S-0063-Operand of ~ must be an integer type (regex.c: 756) PGC-W-0084-Type of old-style argument src does not match type of prototype argument src (regex.c: 763) PGC-S-0043-Redefinition of symbol, bitset_mask (regex.c: 763) PGC-S-0100-Non-integral operand for mod, shift, or bitwise operator (regex.c: 766) PGC-W-0155-Long value is passed to a nonprototyped function - argument #5 (regex.c: 3152) PGC-W-0155-Long value is passed to a nonprototyped function - argument #3 (regex.c: 4261) PGC-W-0155-Long value is passed to a nonprototyped function - argument #3 (regex.c: 4383) PGC-W-0155-Long value is passed to a nonprototyped function - argument #3 (regex.c: 4427) PGC-W-0155-Long value is passed to a nonprototyped function - argument #3 (regex.c: 4529) PGC-W-0155-Long value is passed to a nonprototyped function - argument #3 (regex.c: 4585) PGC-W-0155-Long value is passed to a nonprototyped function - argument #4 (regex.c: 4586) PGC-W-0155-Long value is passed to a nonprototyped function - argument #3 (regex.c: 4648) PGC-W-0155-Long value is passed to a nonprototyped function - argument #3 (regex.c: 4701) PGC-W-0155-Long value is passed to a nonprototyped function - argument #3 (regex.c: 4766) PGC-W-0155-Long value is passed to a nonprototyped function - argument #4 (regex.c: 4773) PGC-W-0155-Long value is passed to a nonprototyped function - argument #3 (regex.c: 4846) PGC-W-0155-Long value is passed to a nonprototyped function - argument #3 (regex.c: 4925) PGC-W-0155-Long value is passed to a nonprototyped function - argument #3 (regex.c: 5420) PGC-W-0155-Long value is passed to a nonprototyped function - argument #3 (regex.c: 5436) PGC-W-0155-Long value is passed to a nonprototyped function - argument #3 (regex.c: 5469) PGC-W-0155-Long value is passed to a nonprototyped function - argument #3 (regex.c: 5482) PGC-W-0155-Long value is passed to a nonprototyped function - argument #3 (regex.c: 5510) PGC-W-0155-Long value is passed to a nonprototyped function - argument #3 (regex.c: 5695) PGC-W-0155
Re: [Rd] (PR#8087) NAs by integer overflow in Spearman's test p-value
There is an even simpler way: someone wrote n*(n^2-1) as n*(n-1)*(n+1) and caused the problem. Your superfluous semicolons do definitely make your code harder to read. On Tue, 23 Aug 2005 [EMAIL PROTECTED] wrote: > Full_Name: Jan T. Kim > Version: 2.1.0 (and better) > OS: Linux > Submission from: (NULL) (139.222.3.229) > > > The p value in Spearman's test is NA if the length of x exceeds 46340, due to > an integer overflow, occurring if length(n) > sqrt(2^31): > >> n <- 46341; >> set.seed(1); >> x <- runif(n); >> y <- runif(n); >> cor.test(x, y, method = "spearman"); > >Spearman's rank correlation rho > >data: x and y >S = 1.654965e+13, p-value = NA >alternative hypothesis: true rho is not equal to 0 >sample estimates: >rho >0.002199426 > >Warning message: >NAs produced by integer overflow in: n * n > > The integer overflow occurs in src/library/stats/R/cor.test.R, and it can be > fixed > by converting n to double appropriately (see *** fix label ***, lines 110 > onwards > are shown): > >## Use the test statistic S = sum(rank(x) - rank(y))^2 >## and AS 89 for obtaining better p-values than via the >## simple normal approximation. >## In the case of no ties, S = (1-rho) * (n^3-n)/6. >pspearman <- function(q, n, lower.tail = TRUE) { >if(n <= 1290) # n*(n^2 - 1) does not overflow >.C("prho", > as.integer(n), > as.double(q + 1), > p = double(1), > integer(1), > as.logical(lower.tail), > PACKAGE = "stats")$p >else { # for large n: aymptotic t_{n-2} >n <- as.double(n); # *** fix *** >r <- 1 - 6 * q / (n*(n*n - 1)) >pt(r / sqrt((1 - r^2)/(n-2)), df = n-2, > lower.tail= !lower.tail) >} >} >q <- round((n^3 - n) * (1 - r) / 6) >STATISTIC <- c(S = q) >PVAL <- >switch(alternative, > "two.sided" = { > p <- if(q > (n^3 - n) / 6) > pspearman(q - 1, n, lower.tail = FALSE) > else > pspearman(q, n, lower.tail = TRUE) > min(2 * p, 1) > }, > "greater" = pspearman(q, n, lower.tail = TRUE), > "less" = pspearman(q - 1, n, lower.tail = FALSE)) >if(TIES) >warning("p-values may be incorrect due to ties") > > Inserting the typecast only in the pspearman function is a minimally invasive > fix -- alternatively, replacing at line 17 > >n <- length(x) > > with > >n <- as.double(length(x)) > > achieves the same fix and may take care of other unnecessary integer > overflows, > but it may also introduce new problems e.g. in .C calls etc. > > __ > 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] Extended-Warranty for your vehicle r-bugs (PR#8088)
This is a multi-part message in MIME format. 58736078_abAug1180 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit * If you are reading this text, you either do not have an HTML capable email client, or you choose not to view HTML emails by default. * Q: What if I still want to visit the web site? A: You may follow the url below: http://f.client-2bsmsend.com/t/f.aspx?TID=1180&LID=2578&EID=58736078&VID=273 Q: I refuse to view this message in HTML, how do I remove myself? A: You may follow the url below: http://f.client-2bsmsend.com/t/d.aspx?pepsi=blue&TID=1180&LID=2578&EID=58736078&VID=273 * This email is a paid eAd sent to [EMAIL PROTECTED] by Auto Warranty Dealz on Tue, 23 Aug 2005 11:45:46 -0700. Sender information: Auto Warranty Dealz 350 S. Center Dr. Suite 500 Reno, NV 89501 End of msg. 58736078_abAug1180 Content-Type: text/html; charset="us-ascii" http://f.client-2bsmsend.com/t/f.aspx?TID=1180&LID=2578&EID=58736078&VID=273";>http://i.client-2bsmsend.com/aw4/Email7.jpg"; border="0"> http://f.client-2bsmsend.com/t/f.aspx?TID=1180&LID=2579&EID=58736078&VID=273";>http://i.client-2bsmsend.com/aw4/bottom2.gif"; border="0"> http://www.4carwarranty.com/open.php?cid=13"; height=0 width=0 border=0> http://i.client-2bsmsend.com/bsminc/top.gif"; width="428" height="17"> http://f.client-2bsmsend.com/t/f.aspx?TID=403&LID=765";> http://f.client-2bsmsend.com/t/i.aspx?TID=1180&LID=2578&EID=58736078&VID=273&Image=logo.gif"; width="172" height="75"> This message was intended for: [EMAIL PROTECTED]; http://f.client-2bsmsend.com/t/d.aspx?pepsi=blue&TID=1180&LID=2578&EID=58736078&VID=273";> http://i.client-2bsmsend.com/bsminc/rf.gif"; width="144" height="12"> This message has been sent to you by Auto Warranty Dealz. Auto Warranty Dealz is solely responsible for the fulfillment of products and or services associated with this message and any site this message takes you to here after. If you have any questions regarding this message, please contact Auto Warranty Dealz at 350 S. Center Dr. Suite 500, Reno, NV 89501. This message was sent to [EMAIL PROTECTED], with the last known Internet Protocol (IP) address 66.249.65.15, which is kept on file by the publisher of this message for audit reasons. You may seek information on the publisher by navigating your cursor to the logo-image located at the top-right of this message. If for any reason you no longer want any more messages from Auto Warranty Dealz then please follow the directions above, next to the email address this message was intended for. Thank you and have an excellent . Tuesday, August 23, 2005 11:44 58736078_1144_23082005_1180_1627485? 58736078_abAug1180-- __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] compile R with Portland Group compiler
regex.c is not our code, but from glibc. Could you please try R-devel instead, which has a later version of glibc. Since 2.1.1 is not longer part of the developement, we cannot help with that, but we can help wih R-devel. I see the later regex.c does use prototypes. But bitset is an integer type, so that may be a compiler error. (It is on my list to try Intel and PG compilers on AMD64 as we have licences, but not very high priority.) On Tue, 23 Aug 2005, Jennifer Lai wrote: > Hi, >Can anyone advise me on how to compile R with Portland Group > compiler on a Opeteron machine with Red Hat Enterprise Linux WS release > 4 installed? > > I've edit config.site file to pick portland group compilers instead of > gcc. Here is the list of modified flags: > CC=/usr/pgi/linux86-64/6.0/bin/pgcc > CFLAGS='-g -O2' > CPPFLAGS='-I/usr/pgi/linux86-64/6.0/include > -I/usr/pgi/linux86-64/6.0/include/CC' > F77=/usr/pgi/linux86-64/6.0/bin/pgf77 > FLAGS='-O2' > CPICFLAGS=-fPIC > FPICFLAGS=-fPIC > SHLIB_LDFLAGS=-shared > LDFLAGS='-L/usr/pgi/linux86-64/6.0/lib -L/usr/lib64' > CXX=/usr/pgi/linux86-64/6.0/bin/pgCC > CXXPICFLAGS=-fPIC > SHLIB_CXXLDFLAGS=-shared > > > When I ran configure, I didn't get any error message, but config.log > indicated there are errors, That's fine: it is not GNU C so it should give an error. > configure:4102: $? = 0 > configure:4124: result: o > configure:4128: checking whether we are using the GNU C compiler > configure:4152: /usr/pgi/linux86-64/6.0/bin/pgcc -c -g -O2 > -I/usr/pgi/linux86-64/6.0/include -I/usr/pgi/linux86-64/6.0/include/C\ > C conftest.c >&5 > PGC-S-0040-Illegal use of symbol, choke (conftest.c: 21) > PGC/x86-64 Linux/x86-64 6.0-5: compilation completed with severe errors > configure:4158: $? = 2 > configure: failed program was: > | /* confdefs.h. */ > | > | #define PACKAGE_NAME "R" > | #define PACKAGE_TARNAME "R" > | #define PACKAGE_VERSION "2.1.1" > | #define PACKAGE_STRING "R 2.1.1" > | #define PACKAGE_BUGREPORT "[EMAIL PROTECTED]" > | #define PACKAGE "R" > | #define VERSION "2.1.1" > | #define R_PLATFORM "x86_64-unknown-linux-gnu" > | #define R_CPU "x86_64" > | #define R_VENDOR "unknown" > | #define R_OS "linux-gnu" > | #define Unix 1 > | /* end confdefs.h. */ > | > | int > | main () > | { > | #ifndef __GNUC__ > |choke me > | #endif > | > | ; > | return 0; > | } > configure:4184: result: no > configure:4190: checking whether /usr/pgi/linux86-64/6.0/bin/pgcc accepts -g > > > If I ignored the config.log errors and went ahead to do make, I got the > following errors, > make[3]: Entering directory `/home/cuser/AMD_BENCH/R-2.1.1/src/main' > /usr/pgi/linux86-64/6.0/bin/pgcc -I../../src/extra/zlib > -I../../src/extra/bzip2 -I../../src/extra/pcre -I. -I../../src/include > -I../../src/include -I/usr/pgi/linux86-64/6.0/include > -I/usr/pgi/linux86-64/6.0/include/CC -DHAVE_CONFIG_H -g -O2 -c regex.c > -o regex.o > PGC-W-0155-64-bit integral value truncated (/usr/include/wctype.h: 109) > PGC-W-0155-64-bit integral value truncated (/usr/include/wctype.h: 110) > PGC-W-0155-64-bit integral value truncated (/usr/include/wctype.h: 111) > PGC-W-0155-64-bit integral value truncated (/usr/include/wctype.h: 112) > PGC-W-0084-Type of old-style argument src does not match type of > prototype argument src (regex.c: 743) > PGC-S-0043-Redefinition of symbol, bitset_merge (regex.c: 743) > PGC-S-0100-Non-integral operand for mod, shift, or bitwise operator > (regex.c: 746) > PGC-W-0084-Type of old-style argument src does not match type of > prototype argument src (regex.c: 753) > PGC-S-0043-Redefinition of symbol, bitset_not_merge (regex.c: 753) > PGC-S-0063-Operand of ~ must be an integer type (regex.c: 756) > PGC-W-0084-Type of old-style argument src does not match type of > prototype argument src (regex.c: 763) > PGC-S-0043-Redefinition of symbol, bitset_mask (regex.c: 763) > PGC-S-0100-Non-integral operand for mod, shift, or bitwise operator > (regex.c: 766) > PGC-W-0155-Long value is passed to a nonprototyped function - argument > #5 (regex.c: 3152) > PGC-W-0155-Long value is passed to a nonprototyped function - argument > #3 (regex.c: 4261) > PGC-W-0155-Long value is passed to a nonprototyped function - argument > #3 (regex.c: 4383) > PGC-W-0155-Long value is passed to a nonprototyped function - argument > #3 (regex.c: 4427) > PGC-W-0155-Long value is passed to a nonprototyped function - argument > #3 (regex.c: 4529) > PGC-W-0155-Long value is passed to a nonprototyped function - argument > #3 (regex.c: 4585) > PGC-W-0155-Long value is passed to a nonprototyped function - argument > #4 (regex.c: 4586) > PGC-W-0155-Long value is passed to a nonprototyped function - argument > #3 (regex.c: 4648) > PGC-W-0155-Long value is passed to a nonprototyped function - argument > #3 (regex.c: 4701) > PGC-W-0155-Long value is passed to a nonprototyped function - argument > #3 (regex.c: 4766) > PGC-W-0155-Long value is passed to a nonprototyped function - argument > #4 (regex.c: 477
[Rd] Auto coverage too high r-bugs? Take a look (PR#8090)
This is a multi-part message in MIME format. 58736078_abAug1212 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit * If you are reading this text, you either do not have an HTML capable email client, or you choose not to view HTML emails by default. * Q: What if I still want to visit the web site? A: You may follow the url below: http://f.client-2bsmsend.com/t/f.aspx?TID=1212&LID=2740&EID=58736078&VID=268 Q: I refuse to view this message in HTML, how do I remove myself? A: You may follow the url below: http://f.client-2bsmsend.com/t/d.aspx?pepsi=blue&TID=1212&LID=2740&EID=58736078&VID=268 * This email is a paid eAd sent to [EMAIL PROTECTED] by WorldClass Strategy on Tue, 23 Aug 2005 14:32:34 -0700. Sender information: WorldClass Strategy 1932 1st. Ave Suite 314 Seattle, WA 98101 End of msg. 58736078_abAug1212 Content-Type: text/html; charset="us-ascii" Get a free auto insurance quote in 5 minutes call us today at 1-800-620-2666 or http://f.client-2bsmsend.com/t/f.aspx?TID=1212&LID=2740&EID=58736078&VID=268";> Click hereLook, Learn, Compare and Buy! http://f.client-2bsmsend.com/t/f.aspx?TID=1212&LID=2740&EID=58736078&VID=268";>http://i.client-2bsmsend.com/afinew/header1.jpg"; border=0> Answer a few questions. Fill in some information. Click “get quotes.” When you see the plan and price you like, click “apply.” If it says, “Buy Online” next to the plan you’ve chosen, you’ll fill in some additional information, get confirmation and INSTANTLY DOWNLOAD YOUR OWN PROOF OF INSURANCE. http://f.client-2bsmsend.com/t/f.aspx?TID=1212&LID=2740&EID=58736078&VID=268";>http://i.client-2bsmsend.com/afinew/header2.jpg";> http://i.client-2bsmsend.com/afinew/logos.gif";> http://i.client-2bsmsend.com/afinew/keyline1.gif";> Insurance products and serrvices are provided by Answer Financial® Inc. through its licensed insurance agencies, Insurance Answer Center®, Inc. (California License No. 0B99714), Answer Center Insurance Agency, Inc. and other affiliates. Some products and services may not be available in all states and rates are subject to change. This message has been sent to you because you have provided your email address to Answer Financial. http://f.client-2bsmsend.com/t/f.aspx?TID=1212&LID=2741&EID=58736078&VID=268";>PRIVACY POLICY | http://f.client-2bsmsend.com/t/f.aspx?TID=1212&LID=2742&EID=58736078&VID=268";>UNSUBSCRIBE Answer Financial 15910 Ventura Blvd. Encino, CA 91436-2802 http://r.4at1.com/c/e/r/spacer.tif?sid=231.19132.574773.985.136840012";> http://i.client-2bsmsend.com/bsminc/top.gif"; width="428" height="17"> http://f.client-2bsmsend.com/t/f.aspx?TID=403&LID=765";> http://f.client-2bsmsend.com/t/i.aspx?TID=1212&LID=2740&EID=58736078&VID=268&Image=logo.gif"; width="172" height="75"> This message was intended for: [EMAIL PROTECTED]; http://f.client-2bsmsend.com/t/d.aspx?pepsi=blue&TID=1212&LID=2740&EID=58736078&VID=268";> http://i.client-2bsmsend.com/bsminc/rf.gif"; width="144" height="12"> This message has been sent to you by WorldClass Strategy. WorldClass Strategy is solely responsible for the fulfillment of products and or services associated with this message and any site this message takes you to here after. If you have any questions regarding this message, please contact WorldClass Strategy at 1932 1st. Ave Suite 314, Seattle, WA 98101. This message was sent to [EMAIL PROTECTED], with the last known Internet Protocol (IP) address 66.249.65.15, which is kept on file by the publisher of this message for audit reasons. You may seek information on the publisher by navigating your cursor to the logo-image located at the top-right of this message. If for any reason you no longer want any more messages from WorldClass Strategy then please follow the directions above, next to the email address this message was intended for. Thank you and have an excellent afternoon. Tuesday, August 23, 2005 14:31 58736078_1431_23082005_1212_1724002? 58736078_abAug1212-- ___