[Rd] reg-tests-1.R failure with unstable
Hi, I am getting an error from one of the test files tests/reg-tests-1.R using the unstable version (r50179). (i've learned my lessons; this is a clean build.) The tail of reg-tests-1.Rout.fail is Loading required package: myTst building package pkgA ... installing package pkgA using file pkgA_1.0.tar.gz ... Error in as.octmode(mode) : invalid digits Error in install.packages(r, lib = "myLib", repos = NULL, type = "source") : (converted from warning) installation of package 'pkgA_1.0.tar.gz' had non-zero exit status Execution halted The error from as.octmode() appears to be coming from R CMD INSTALL. If I unpack pkgA_1.0.tar.gz, 'R CMD INSTALL pkgA' from the source tree works fine. However, 'R CMD INSTALL pkgA_1.0.tar.gz' returns the error. I am wondering whether this is specific to my OS (FreeBSD). Any pointers for debugging would be appreciated. h. -- +--- | Hiroyuki Kawakatsu | Business School, Dublin City University | Dublin 9, Ireland. Tel +353 (0)1 700 7496 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] trigamma for very large arguments (PR#14020)
> "JL" == Jerry Lewis > on Thu, 22 Oct 2009 04:20:13 +0200 (CEST) writes: JL> Full_Name: Jerry W. Lewis JL> Version: 2.9.2 JL> OS: Windows XP Professional JL> Submission from: (NULL) (96.237.55.233) JL> trigamma(x) returns 0 for x>1e152, yet JL> trigamma <- function(x) 1/x JL> gives machine accuracy for any x>1e16 Thank you, yes, and the problem is worse for digamma(). I will fix this, but not anymore for R 2.10.0 (we are in code freeze!) Martin Maechler, ETH Zurich __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Error in link in Rd file stops package installation
On 10/22/2009 11:03 PM, William Dunlap wrote: The following patch seems to get the warning message right Thanks, I'll put this in if nobody else gets there first. Duncan Murdoch lag.zoo html Rd warning: ./man/lag.zoo.Rd:54: file link 'diff' in package 'stats' does not exist and so has been treated as a topic Index: src/library/tools/R/Rd2HTML.R === --- src/library/tools/R/Rd2HTML.R (revision 50178) +++ src/library/tools/R/Rd2HTML.R (working copy) @@ -305,7 +305,7 @@ if (!OK) { ## so how about as a topic? file <- utils:::index.search(parts$targetfile, pkgpath) -if (nzchar(file)) { +if (length(file)==0 || nzchar(file)) { warnRd(block, Rdfile, "file link ", sQuote(parts$targetfile), " in package ", sQuote(parts$pkg), Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message- From: r-devel-boun...@r-project.org [mailto:r-devel-boun...@r-project.org] On Behalf Of William Dunlap Sent: Thursday, October 22, 2009 1:54 PM To: R-devel@r-project.org Subject: [Rd] Error in link in Rd file stops package installation With a pretty recent version of R 2.11.0 (devel,unstable, svn 50178) on Linux I could not install version 1.5-8 of zoo (the current on on CRAN): % R-devel CMD INSTALL -l Rlib3 zoo * installing *source* package 'zoo' ... ** R ** inst ** preparing package for lazy loading ** help *** installing help indices converting help for package 'zoo' finding HTML links ... done MATCH html ORDER html aggregate.zoo html as.Date.ts html as.zoo html coredatahtml frequency html index html is.regular html lag.zoo html Error: argument is of length zero * removing '/a/seafiler01.na.tibco.com/vol/vol2/users/bill/packages/Rlib3/zoo' The tryCatch calls in the installer code obliterate most traces of where this 'argument is of length zero' comes from. If I run the install from a directory containing the .Rprofile file containing the line utils::assignInNamespace("tryCatch", function(expr, ...) expr, ns="base") then I get: ... is.regular html lag.zoo html Error in if (nzchar(file)) { : argument is of length zero * removing '/a/seafiler01.na.tibco.com/vol/vol2/users/bill/packages/Rlib3/zoo' * restoring previous '/a/seafiler01.na.tibco.com/vol/vol2/users/bill/packages/Rlib3/zoo' and I can grep around for 'if (nzchar(file))'. (Redefining q() in .Rprofile to give a traceback can help in the search also.) After the attached change to Rd2HTML I get ... index html is.regular html lag.zoo html Rd warning: ./man/lag.zoo.Rd:54: missing file link 'diff' make.par.list html merge.zoo html ... Line 54 of that help file is \seealso{\code{\link{zoo}}, \code{\link[stats]{lag}}, \code{\link[stats]{diff}}} and I think the [stats]{diff} should be [base]{diff}. The change I made (which isn't quite right but avoids mysteriously killing the installation for what turns out to be a minor error) was Index: src/library/tools/R/Rd2HTML.R === --- src/library/tools/R/Rd2HTML.R (revision 50178) +++ src/library/tools/R/Rd2HTML.R (working copy) @@ -305,7 +305,7 @@ if (!OK) { ## so how about as a topic? file <- utils:::index.search(parts$targetfile, pkgpath) -if (nzchar(file)) { +if (length(file)>0 && nzchar(file)) { warnRd(block, Rdfile, "file link ", sQuote(parts$targetfile), " in package ", sQuote(parts$pkg), A longer range fix would be to print more contextual information with the error messages from INSTALL. Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com __ 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 ___
Re: [Rd] source and textConnection
On 10/22/2009 7:21 AM, Erich Neuwirth wrote: Using todays freshly downloaded compiled version of R-2.10.0 beta let me pose this question once again: myconn<-textConnection("print(11*11)") source(myconn) produces [1] 121 Warning message: In source(myconn) : argument 'encoding = "native.enc"' will be ignored So I get a warning about a default parameter value I did not use myself. This is somewhat strange. Up to 2.9.2 this warning did not show up, and 2.9.2 also has the encoding parameter. source(myconn,encoding="unknown") does not produce a warning. Will it remain like this? I am asking because then I have to adapt a certain mechanism in RExcel. I spent a little time looking into this yesterday, and it appears to have shown up quite a while ago (it was there in July builds, for instance). I will eventually track it down, but certainly not for 2.10.0. Generally bugs are easier to find when they're fresh, which is why we ask people to try out the R-devel builds. In this case, it's obvious how to fix the bug, but I'd rather not do that until I see what the change that caused it was intended to do: I don't want to undo that. Duncan Murdoch __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] Confusion regarding allocating Matrices.
Hi I'm having slight confusion. I plan to grow/realloc a matrix depending on the data available in a C program. Here is what I'm tried to do: Data=allocMatrix(REALSXP,3,4); SEXP Data; REAL(Data)[8]=0.001123; REAL(Data)[20]=0.001125; printf("%f %f\n\n\n\n",REAL(Data)[8],REAL(Data)[20]); Here is my confusion: Do I always require to allocate the exact number of data elements in a R Matrix? In the above code segment I have clearly exceeded the number of elements that have been allocated but my program doesn't crash. I don't find any specific R functions for reallocation incase my data set grows. How do I reallocate? Is it necessary to reallocate or is R handling the memory management for the matrix that I have allocated? Regards Abhijit Bera [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Confusion regarding allocating Matrices.
On Fri, Oct 23, 2009 at 8:39 AM, Abhijit Bera wrote: > Hi > > I'm having slight confusion. Indeed. > I plan to grow/realloc a matrix depending on the data available in a C > program. > Here is what I'm tried to do: > Data=allocMatrix(REALSXP,3,4); > SEXP Data; Those lines should be in the other order, shouldn't they? Also, you need to PROTECT Data or bad things will happen. > REAL(Data)[8]=0.001123; > REAL(Data)[20]=0.001125; > printf("%f %f\n\n\n\n",REAL(Data)[8],REAL(Data)[20]); > Here is my confusion: > Do I always require to allocate the exact number of data elements in a R > Matrix? Yes. > In the above code segment I have clearly exceeded the number of > elements that have been allocated but my program doesn't crash. Remember that when programming in C you have a lot of rope with which to hang yourself. You have corrupted a memory location beyond that allocated to the array but nothing bad has happened - yet. > I don't find any specific R functions for reallocation incase my data set > grows. How do I reallocate? You allocate a new matrix, copy the contents of the current matrix to the new matrix, then release the old one. It gets tricky in that you should unprotect the old one and protect the new one but you need to watch the order of those operations. This approach is not a very good one. If you really need to grow an array it is better to allocate and reallocate the memory within your C code using calloc and realloc then, at the end of the calculations, allocate an R matrix and copy the results over. Also, you haven't said whether you are growing the matrix by row or by column or both. If you are adding rows then you can't just reallocate storage because R stores matrices in column-major order. The positions of the elements in a matrix with n+1 rows are different from those in a matrix with n rows. > Is it necessary to reallocate or is R handling > the memory management for the matrix that I have allocated? > > Regards > > Abhijit Bera > > [[alternative HTML version deleted]] > > __ > 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
Re: [Rd] Confusion regarding allocating Matrices.
On Fri, Oct 23, 2009 at 9:23 AM, Douglas Bates wrote: > On Fri, Oct 23, 2009 at 8:39 AM, Abhijit Bera wrote: >> Hi >> >> I'm having slight confusion. > > Indeed. > >> I plan to grow/realloc a matrix depending on the data available in a C >> program. > >> Here is what I'm tried to do: > >> Data=allocMatrix(REALSXP,3,4); >> SEXP Data; > > Those lines should be in the other order, shouldn't they? > > Also, you need to PROTECT Data or bad things will happen. > >> REAL(Data)[8]=0.001123; >> REAL(Data)[20]=0.001125; >> printf("%f %f\n\n\n\n",REAL(Data)[8],REAL(Data)[20]); And I forgot to mention, it is not a good idea to write REAL(Data) many times like this. REAL is a function, not a macro and you are calling the same function over and over again unnecessarily. It is better to write double *dat = REAL(Data); and use the dat pointer instead of REAL(Data). >> Here is my confusion: > >> Do I always require to allocate the exact number of data elements in a R >> Matrix? > > Yes. > >> In the above code segment I have clearly exceeded the number of >> elements that have been allocated but my program doesn't crash. > > Remember that when programming in C you have a lot of rope with which > to hang yourself. You have corrupted a memory location beyond that > allocated to the array but nothing bad has happened - yet. > >> I don't find any specific R functions for reallocation incase my data set >> grows. How do I reallocate? > > You allocate a new matrix, copy the contents of the current matrix to > the new matrix, then release the old one. It gets tricky in that you > should unprotect the old one and protect the new one but you need to > watch the order of those operations. > > This approach is not a very good one. If you really need to grow an > array it is better to allocate and reallocate the memory within your C > code using calloc and realloc then, at the end of the calculations, > allocate an R matrix and copy the results over. > > Also, you haven't said whether you are growing the matrix by row or by > column or both. If you are adding rows then you can't just reallocate > storage because R stores matrices in column-major order. The positions > of the elements in a matrix with n+1 rows are different from those in > a matrix with n rows. > >> Is it necessary to reallocate or is R handling >> the memory management for the matrix that I have allocated? >> >> Regards >> >> Abhijit Bera >> >> [[alternative HTML version deleted]] >> >> __ >> 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] (PR#14020) trigamma for very large arguments
More generally, the accuracy and working range of psigamma(x,deriv) can be improved by having it return the leading term of the asymptotic expansion (-1)^(deriv-1)*factorial(deriv-1)/x^deriv whenever deriv>=1 and x>=1e15 [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] source and textConnection
On 10/23/2009 8:27 AM, Duncan Murdoch wrote: On 10/22/2009 7:21 AM, Erich Neuwirth wrote: Using todays freshly downloaded compiled version of R-2.10.0 beta let me pose this question once again: myconn<-textConnection("print(11*11)") source(myconn) produces [1] 121 Warning message: In source(myconn) : argument 'encoding = "native.enc"' will be ignored So I get a warning about a default parameter value I did not use myself. This is somewhat strange. Up to 2.9.2 this warning did not show up, and 2.9.2 also has the encoding parameter. source(myconn,encoding="unknown") does not produce a warning. Will it remain like this? I am asking because then I have to adapt a certain mechanism in RExcel. I spent a little time looking into this yesterday, and it appears to have shown up quite a while ago (it was there in July builds, for instance). I will eventually track it down, but certainly not for 2.10.0. Nothing is certain. I found that this warning came from something I introduced in May; it appears to me to be in the class of trivial bugs that the development guidelines allow to be fixed now. So I've committed the change to the 2.10.0 branch. Duncan Murdoch Generally bugs are easier to find when they're fresh, which is why we ask people to try out the R-devel builds. In this case, it's obvious how to fix the bug, but I'd rather not do that until I see what the change that caused it was intended to do: I don't want to undo that. Duncan Murdoch __ 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
Re: [Rd] Confusion regarding allocating Matrices.
Sorry, I made a mistake while writing the code. The declaration of Data should have been first. I still have some doubts: When you say calloc and realloc are you talking about R's C interface Calloc and Realloc or the regular calloc and realloc? I want to feed data directly into a R matrix and grow it as required. So at one time I might have 100 rows coming in from a data source. The next time I might have 200 rows coming in from a data source. I want to be able to expand the R-matrix instead of creating a regular C float matrix and then make an R-matrix based on the new size. I just want to have one R object and be able to expand it's size dynamically. I was reading the language specs. It says that one could declare an object in R like this: m=matrix(nrows=10,ncols=10) and then one could assign m[101]=1.00 to expand the object. but this has one problem when I do a dim(m) I get NULL instead of 10 10 So what is happening here? I am aware that R matrices are stored in column major order. Thanks for the tip on using float *dat= REAL(Data); Regards Abhijit Bera On Fri, Oct 23, 2009 at 7:27 PM, Douglas Bates wrote: > On Fri, Oct 23, 2009 at 9:23 AM, Douglas Bates > wrote: > > On Fri, Oct 23, 2009 at 8:39 AM, Abhijit Bera > wrote: > >> Hi > >> > >> I'm having slight confusion. > > > > Indeed. > > > >> I plan to grow/realloc a matrix depending on the data available in a C > >> program. > > > >> Here is what I'm tried to do: > > > >> Data=allocMatrix(REALSXP,3,4); > >> SEXP Data; > > > > Those lines should be in the other order, shouldn't they? > > > > Also, you need to PROTECT Data or bad things will happen. > > > >> REAL(Data)[8]=0.001123; > >> REAL(Data)[20]=0.001125; > >> printf("%f %f\n\n\n\n",REAL(Data)[8],REAL(Data)[20]); > > And I forgot to mention, it is not a good idea to write REAL(Data) > many times like this. REAL is a function, not a macro and you are > calling the same function over and over again unnecessarily. It is > better to write > > double *dat = REAL(Data); > > and use the dat pointer instead of REAL(Data). > > >> Here is my confusion: > > > >> Do I always require to allocate the exact number of data elements in a R > >> Matrix? > > > > Yes. > > > >> In the above code segment I have clearly exceeded the number of > >> elements that have been allocated but my program doesn't crash. > > > > Remember that when programming in C you have a lot of rope with which > > to hang yourself. You have corrupted a memory location beyond that > > allocated to the array but nothing bad has happened - yet. > > > >> I don't find any specific R functions for reallocation incase my data > set > >> grows. How do I reallocate? > > > > You allocate a new matrix, copy the contents of the current matrix to > > the new matrix, then release the old one. It gets tricky in that you > > should unprotect the old one and protect the new one but you need to > > watch the order of those operations. > > > > This approach is not a very good one. If you really need to grow an > > array it is better to allocate and reallocate the memory within your C > > code using calloc and realloc then, at the end of the calculations, > > allocate an R matrix and copy the results over. > > > > Also, you haven't said whether you are growing the matrix by row or by > > column or both. If you are adding rows then you can't just reallocate > > storage because R stores matrices in column-major order. The positions > > of the elements in a matrix with n+1 rows are different from those in > > a matrix with n rows. > > > >> Is it necessary to reallocate or is R handling > >> the memory management for the matrix that I have allocated? > >> > >> Regards > >> > >> Abhijit Bera > >> > >>[[alternative HTML version deleted]] > >> > >> __ > >> R-devel@r-project.org mailing list > >> https://stat.ethz.ch/mailman/listinfo/r-devel > >> > > > [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel