[Rd] update.formula simplify = FALSE

2012-05-15 Thread isubirana
Dear R users,

I am building a packaged where I want to use the update.formula function,
but modifying the option simplify = TRUE to FALSE. Since this is not an
argument, I modified the code and created a new function as:

update.formula2 - function (old, new, ...) {
tmp - .Internal(update.formula(as.formula(old), as.formula(new)))
out - formula(terms.formula(tmp, simplify = FALSE))
return(out)
}

This works fine. But when creating and checking the package (R CMD check
--as-cran mypackage), I obtained a warning saying that .Internal function
cannot be used inside a package.

Does anyone know how to define an update.formula (or equivalent) setting
simplify = FALSE?

Thanks.


Isaac Subirana.
IMIM. Barcelona.

--
View this message in context: 
http://r.789695.n4.nabble.com/update-formula-simplify-FALSE-tp4629964.html
Sent from the R devel mailing list archive at Nabble.com.

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


[Rd] Package does not have a NAMESPACE and should be re-installed

2012-05-15 Thread walcott3
I'm trying to load a package locally from a zip file. When I load the  
package, I first get this, which looks okay:


package ?IBGEPesq? successfully unpacked and MD5 sums checked

HOWEVER, when I try to use the package to use the data with
library(IBGEPesq)

I get this message:

 package ?IBGEPesq? does not have a NAMESPACE and should be re-installed

I've tried re-installing it, and I've tried following suggestions on  
similar posts, but with no success.


Help please.

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


Re: [Rd] Package does not have a NAMESPACE and should be re-installed

2012-05-15 Thread Duncan Murdoch

On 12-05-14 2:37 PM, walco...@msu.edu wrote:

I'm trying to load a package locally from a zip file. When I load the
package, I first get this, which looks okay:

package ?IBGEPesq? successfully unpacked and MD5 sums checked

HOWEVER, when I try to use the package to use the data with
library(IBGEPesq)

I get this message:

   package ?IBGEPesq? does not have a NAMESPACE and should be re-installed

I've tried re-installing it, and I've tried following suggestions on
similar posts, but with no success.


The .zip file was likely produced by an earlier version of R.  It is 
essentially a copy of an installed version of the package.  You need a 
new .zip file, produced by the same version of R as you are using.


Duncan Murdoch

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


Re: [Rd] Package does not have a NAMESPACE and should be re-installed

2012-05-15 Thread walcotteric

Duncan Murdoch-2 wrote
 
 On 12-05-14 2:37 PM, walcott3@ wrote:
 I'm trying to load a package locally from a zip file. When I load the
 package, I first get this, which looks okay:

 package ?IBGEPesq? successfully unpacked and MD5 sums checked

 HOWEVER, when I try to use the package to use the data with
 library(IBGEPesq)

 I get this message:

package ?IBGEPesq? does not have a NAMESPACE and should be
 re-installed

 I've tried re-installing it, and I've tried following suggestions on
 similar posts, but with no success.
 
 The .zip file was likely produced by an earlier version of R.  It is 
 essentially a copy of an installed version of the package.  You need a 
 new .zip file, produced by the same version of R as you are using.
 
 Duncan Murdoch
 
 __
 R-devel@ mailing list
 https://stat.ethz.ch/mailman/listinfo/r-devel
 


I'm not sure I can get the newer version (it's census data from another
country). Is there a way to figure out which version of R was used and just
install that temporarily?

--
View this message in context: 
http://r.789695.n4.nabble.com/Package-does-not-have-a-NAMESPACE-and-should-be-re-installed-tp4630059p4630070.html
Sent from the R devel mailing list archive at Nabble.com.

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


Re: [Rd] Vignette problem

2012-05-15 Thread Terry Therneau

Duncan,
  Thanks for the ideas.  I checked them out and none seem to be the 
culprit.  My original message was wrong in one detail BTW, as I was 
already using graphicx not graphics.
  I switched over to the central server machine (CENTOS) to finish up 
the coxme submission until I could figure this out.  Ran CMD check, 
tidied up the NAMESPACE, DESCRIPTION, NEWS files, fixed a missing $ sign 
in an Rnw, etc.  Submitted the final to CRAN, then updated all the files 
on the Linux box from which the error below came -- both boxes point to 
the same Mercurial master --- and then tried again.
  Now it works!  And I have no idea what could have prompted the 
change.  It will remain a mystery, since I'm not going to try to bring 
the error back. :-)


Terry T.

On 05/14/2012 01:19 PM, Duncan Murdoch wrote:

On 14/05/2012 1:28 PM, Terry Therneau wrote:

I'm having a problem rebuilding a package, new to me in R 2.15.0
(Linux)  It hits all that contain the line
\usepackage[pdftex]{graphics}

and leads to the following when running R CMD check on the directory.
(I do this often; a final run on the tar.gz file will happen before
submission.)
Since I float and resize my figures, removing the line is fatal in other
ways.



* checking re-building of vignette PDFs ... NOTE
Error in re-building vignettes:
...
/usr/share/texmf-texlive/tex/latex/pdftex-def/pdftex.def:414: Package
pdftex.de
f Error: PDF mode expected, but DVI mode detected!
(pdftex.def)If you are using `latex', then call 
`pdflatex'.
(pdftex.def)Otherwise check and correct the driver 
options.

(pdftex.def)Error recovery by switching to PDF mode.

See the pdftex.def package documentation for explanation.
Type  Hreturn   for immediate help.
   ...

l.414 }\@ehc

?
/usr/share/texmf-texlive/tex/latex/pdftex-def/pdftex.def:414: Emergency
stop.
   ...

l.414 }\@ehc

No pages of output.
Transcript written on lmekin.log.
/usr/bin/texi2dvi: latex exited with bad status, quitting.
make: *** [lmekin.pdf] Error 1
Error in buildVignettes(dir =
/home/therneau/research/surv/Hg/coxme.Rcheck/vign_test/coxme) :
running 'make' failed
Execution halted

-

The resulting .tex file work just fine with pdflatex, however.  I
haven't found any reference to this elsewhere, but my guess is that it
is something simple that I've missed.


Do you have an explicit \usepackage{Sweave} in your file?  If not, 
Sweave will add one, and that might explain the difference between 
your two tests.


Another possibility is that you have a copy of Sweave.sty that is not 
the same as the one being used in one run or the other.  The checks 
will try to tell pdflatex to use the one that comes with your R 
version, but other local ones can sometimes have higher precedence in 
pdflatex.


And one idea what the problem might be: Sweave.sty uses the graphicx 
package, and it may conflict with the graphics package.


Duncan Murdoch


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


[Rd] How to set up an object to share data across diverse functions

2012-05-15 Thread John C Nash
In the past 6 months I've been struggling with an issue that has been raised 
periodically
on the lists. This is the need to share information across a group of 
functions, possibly
from different packages. So far I've found solutions that are either quite 
clumsy or else
don't work as have (likely incorrectly) read the manuals.

I'll be writing up my experiences as a way to help others, but am wondering if 
there is an
accepted way to establish an object that can be read and written by a number of 
functions.
I'm currently using list2env to create a list under the umbrella function, 
and if
necessary pass this to other functions by name through the dot arguments, though
preferably I'd rather use a pre-arranged and fixed name (this does not seem to 
work unless
the object is in the global environment, and then I've occasionally had locked 
bindings
errors, which I'll freely admit I don't understand at all). I also have to be 
very careful
with dot arguments, especially if they are matrices.

I've a couple of examples, but they are pretty long, so I'll save for off-list 
transmission.

JN

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


Re: [Rd] Package does not have a NAMESPACE and should be re-installed

2012-05-15 Thread jthetzel
If you do not have access to the package's source code, you can try unzipping
the the zip file, adding a NAMESPACE file, and re-zipping the package.  
It's not ideal, but it should work.  This post from Stack Overflow has some
more details:
http://stackoverflow.com/questions/8012596/error-with-asreml-d-package-in-r-2-14-0/8014357#8014357
.

Jeremy


Jeremy Hetzel
Boston University



walcotteric wrote
 
 I'm trying to load a package locally from a zip file. When I load the  
 package, I first get this, which looks okay:
 
 package ?IBGEPesq? successfully unpacked and MD5 sums checked
 
 HOWEVER, when I try to use the package to use the data with
 library(IBGEPesq)
 
 I get this message:
 
   package ?IBGEPesq? does not have a NAMESPACE and should be re-installed
 
 I've tried re-installing it, and I've tried following suggestions on  
 similar posts, but with no success.
 
 

-
Jeremy T. Hetzel
Boston University
--
View this message in context: 
http://r.789695.n4.nabble.com/Package-does-not-have-a-NAMESPACE-and-should-be-re-installed-tp4630059p4630093.html
Sent from the R devel mailing list archive at Nabble.com.

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


[Rd] Object-oriented programming (OOP)

2012-05-15 Thread Alfredo Naime
Hello everybody, please excuse my bad English. I am Alfredo Naime and
I'm from to Venezuela.

I want to make a lib with tools for simulation (queues, inventories,
factory, etc.) using object-oriented programming (OOP).

You have any manuals on the handling of data types, classes,
inheritance, etc. in R with examples and how to make a R lib.

Thank you, very much.

Alfredo

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


Re: [Rd] Object-oriented programming (OOP)

2012-05-15 Thread R. Michael Weylandt
R has multiple OO paradigms, but since you're starting from a point of
I want object oriented, I'd guess you would be interested in the S4
paradigm which is stricter rather than the far more sane S3 system.

If S4 is for you, there are some good links here:
http://stackoverflow.com/questions/4143611/sources-on-s4-objects-methods-and-programming-in-r

See also the relatively new Reference Classes -- I don't have much
documentation on those, but you could start here:
http://www.bioconductor.org/help/course-materials/2010/HeidelbergNovember2010/ReferenceClasses-Morgan.pdf

Best,
Michael

On Tue, May 15, 2012 at 9:55 AM, Alfredo Naime alfredon...@gmail.com wrote:
 Hello everybody, please excuse my bad English. I am Alfredo Naime and
 I'm from to Venezuela.

 I want to make a lib with tools for simulation (queues, inventories,
 factory, etc.) using object-oriented programming (OOP).

 You have any manuals on the handling of data types, classes,
 inheritance, etc. in R with examples and how to make a R lib.

 Thank you, very much.

 Alfredo

 __
 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] Package does not have a NAMESPACE and should be re-installed

2012-05-15 Thread walcotteric

jthetzel wrote
 
 If you do not have access to the package's source code, you can try
 unzipping the the zip file, adding a NAMESPACE file, and re-zipping the
 package.   It's not ideal, but it should work.  This post from Stack
 Overflow has some more details:
 http://stackoverflow.com/questions/8012596/error-with-asreml-d-package-in-r-2-14-0/8014357#8014357
 .
 
 Jeremy
 
 
 Jeremy Hetzel
 Boston University
 
 
 


Thanks! That worked and the package and library are loaded, and it shows
that there is data there when I used

data()

However, now when I try to load the data to work with it, I get the
following:

Error in data(ocupacao2005) : invalid 'setTime' argument
In addition: Warning message:
In data(ocupacao2005) : zipped data found for package ‘IBGEPesq’.
That is defunct, so please re-install the package.

I'm playing around with it trying to fix it, but not sure exactly what it
means. Any suggestions?


--
View this message in context: 
http://r.789695.n4.nabble.com/Package-does-not-have-a-NAMESPACE-and-should-be-re-installed-tp4630059p4630132.html
Sent from the R devel mailing list archive at Nabble.com.

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


[Rd] R-devel on FreeBSD: new C99 functions don't build

2012-05-15 Thread Rainer Hurling
About April 25th, there had been some changes within R-devel's 
src/nmath/pnbeta.c (and probably some other relevant places) and now 
building R-devel on FreeBSD 10.0-CURRENT (amd64) with gcc-4.6.4 and 
math/R-devel (selfmade forked port from math/R) fails like this:


[..snip..]
mkdir /usr/ports/math/R-devel/work/R-devel/bin/exec
gcc46 -std=gnu99 -I../../src/extra   -I. -I../../src/include 
-I../../src/include -I/usr/local/include -DHAVE_CONFIG_H  -fopenmp -fpic 
   -O2 -pipe -O2 -fno-strict-aliasing -pipe -msse3 
-Wl,-rpath=/usr/local/lib/gcc46 -c Rmain.c -o Rmain.o
gcc46 -std=gnu99 -export-dynamic -fopenmp -L/usr/local/lib 
-Wl,-rpath=/usr/local/lib/gcc46 -o R.bin Rmain.o -L../../lib -lR -lRblas

../../lib/libR.so: undefined reference to `log1pl'
collect2: ld returned 1 exit status
*** [R.bin] Error code 1
Stop in /usr/ports/math/R-devel/work/R-devel/src/main.
*** [R] Error code 1
Stop in /usr/ports/math/R-devel/work/R-devel/src/main.
*** [R] Error code 1
Stop in /usr/ports/math/R-devel/work/R-devel/src.
*** [R] Error code 1
Stop in /usr/ports/math/R-devel/work/R-devel.
*** [do-build] Error code 1
Stop in /usr/ports/math/R-devel.
*** [build] Error code 1
Stop in /usr/ports/math/R-devel.
=== make failed for math/R-devel


It seems, that at least one new C99 function (log1pl) is introduced in 
R-devel, see


src/nmath/pnbeta.c:l95
return (double) (log_p ? log1pl(-ans) : (1 - ans));

for which there is only a declaration in FreeBSDs math.h, but no full 
implementation in libm (see http://wiki.freebsd.org/MissingMathStuff).


Is there any chance to get at least rudimentary replacement functions in 
R-devel for systems with missing or defective C99 math functions?


(For example, in the similar case of log1p(), see the RMATH_HAVE_LOG1P 
and RMATH_HAVE_WORKING_LOG1P bits in the configure script, 
src/include/Rmath.h0.in, and src/nmath/log1p.c; thanks to b.f. for 
pointing me out to this).


Thanks for any help,
Rainer Hurling


CC'ed to b.f. as the maintainer of the math/R port on FreeBSD.

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


Re: [Rd] Package does not have a NAMESPACE and should be re-installed

2012-05-15 Thread jthetzel


 Thanks! That worked and the package and library are loaded, and it shows
 that there is data there when I used
 
 data()
 
 However, now when I try to load the data to work with it, I get the
 following:
 
 Error in data(ocupacao2005) : invalid 'setTime' argument
 In addition: Warning message:
 In data(ocupacao2005) : zipped data found for package ‘IBGEPesq’.
 That is defunct, so please re-install the package.
 
 I'm playing around with it trying to fix it, but not sure exactly what it
 means. Any suggestions?
 

1) Does traceback() give any hints as to where the setTime error is coming
from?

2) Zipping data sets in packages was made defunct in R 2.13.0.  However, I
believe R 2.15 will still load data sets that were zipped using older
versions of R, albeit with the warning that you see.  As you are not the
package maintainer, you can ignore it.


-
Jeremy T. Hetzel
Boston University
--
View this message in context: 
http://r.789695.n4.nabble.com/Package-does-not-have-a-NAMESPACE-and-should-be-re-installed-tp4630059p4630162.html
Sent from the R devel mailing list archive at Nabble.com.

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


Re: [Rd] R-devel on FreeBSD: new C99 functions don't build

2012-05-15 Thread Murray Stokely
On Tue, May 15, 2012 at 10:05 AM, Rainer Hurling rhur...@gwdg.de wrote:
 About April 25th, there had been some changes within R-devel's
 src/nmath/pnbeta.c (and probably some other relevant places) and now
 building R-devel on FreeBSD 10.0-CURRENT (amd64) with gcc-4.6.4 and
 math/R-devel (selfmade forked port from math/R) fails like this:

 It seems, that at least one new C99 function (log1pl) is introduced in
 R-devel, see

 src/nmath/pnbeta.c:l95
 return (double) (log_p ? log1pl(-ans) : (1 - ans));

AFAIK, Bruce Evans is not happy with the numerical accuracy of other
open-source implementations of log1pl and so has blocked their
inclusion in FreeBSD pending work on a better implementation.

Can you put a conditional FreeBSD check here and use log1p instead of
log1pl instead as a workaround?

I can admire the insistence on correctness from the FreeBSD libm
maintainers for their technical purity, but it can be a bit of a pain
for things like this.

 - Murray

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


Re: [Rd] R-devel on FreeBSD: new C99 functions don't build

2012-05-15 Thread Rainer Hurling

On 15.05.2012 20:49 (UTC+1), Murray Stokely wrote:

On Tue, May 15, 2012 at 10:05 AM, Rainer Hurlingrhur...@gwdg.de  wrote:

About April 25th, there had been some changes within R-devel's
src/nmath/pnbeta.c (and probably some other relevant places) and now
building R-devel on FreeBSD 10.0-CURRENT (amd64) with gcc-4.6.4 and
math/R-devel (selfmade forked port from math/R) fails like this:



It seems, that at least one new C99 function (log1pl) is introduced in
R-devel, see

src/nmath/pnbeta.c:l95
return (double) (log_p ? log1pl(-ans) : (1 - ans));


AFAIK, Bruce Evans is not happy with the numerical accuracy of other
open-source implementations of log1pl and so has blocked their
inclusion in FreeBSD pending work on a better implementation.

Can you put a conditional FreeBSD check here and use log1p instead of
log1pl instead as a workaround?

I can admire the insistence on correctness from the FreeBSD libm
maintainers for their technical purity, but it can be a bit of a pain
for things like this.

  - Murray


I read about this discussion and in principle I concur with your 
opinion. As a scientist I tend to expect greatest possible correctness 
from a statistical routine, especially when it uses long double format.


As a quick and dirty workaround I applied the following patch:


--- src/nmath/pnbeta.c.orig 2012-04-25 17:55:14.0 +0200
+++ src/nmath/pnbeta.c  2012-05-15 20:58:26.0 +0200
@@ -92,7 +92,11 @@
 else {
if(ans  1 - 1e-10) ML_ERROR(ME_PRECISION, pnbeta);
if (ans  1.0) ans = 1.0;  /* Precaution */
+#if !defined(__FreeBSD__)
return (double) (log_p ? log1pl(-ans) : (1 - ans));
+#else
+return (double) (log_p ? log1p(-ans) : (1 - ans));
+#endif /* FreeBSD */
 }
 }


It builds and installs fine now and I hope there are no side effects ...

Thank you for the quick answer and your advice,
Rainer

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