Skip to content

R package dev: how to export constant?

9 messages · Jonas Stein, William Dunlap, Rui Barradas +2 more

#
Hi,
i create two constants kilo and milli in [1]. These should be available
after loading 

library(sitools)

How should i export them and what have i done wrong?
(Other suggestions for improving the package are welcome too)

The ready to use .tar.gz and the source can be found on github [2,3]

kind regatds,

[1] https://github.com/jonasstein/sitools/blob/master/init.R
[2] https://github.com/jonasstein/sitools/downloads
[3] https://github.com/jonasstein/sitools
#
Try adding
  LazyData: yes
to the DESCRIPTION file.

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com
#
Hello,

Jonas, I've just seen your function 'sistring' code and it's different from
the code in

R-help, Ben.BigHair, Jan 06, 2012 reply to the thread "automatic SI prefixes
as ticklabels on axis".

The difference is that it's not "as.character(x)", it should be
"as.character(number)"

(The function parameter's name has changed...)

Rui Barradas


--
View this message in context: http://r.789695.n4.nabble.com/R-package-dev-how-to-export-constant-tp4305281p4305569.html
Sent from the R help mailing list archive at Nabble.com.
#
On 2012-01-18, William Dunlap <wdunlap at tibco.com> wrote:
Thank you. Now it works and I could add all SI prefixes.
#
Thanks a lot for reporting this bug. It is fixed now in the git 
repository.

I added some examples, but they do not work:

R CMD check sitools

================= snip
Error: object 'centi' not found
================= snap

Any hints?
Do you think i should rename the convert function to 
"float2si" or something like that?
Perhaps someone needs a si2float converter in future...

Betatesters are welcome. After some more testing i want to upload the 
package to the R package collection.

kind regards,
1 day later
#
So you are still unable to cite the previous part of the thread?
On 19.01.2012 00:13, Jonas Stein wrote:
We do not know the details about that package
We do not know hoe you tried to make that object available now.
No, given you do not manage to tell us how your setup looks like now.
Which convert function? You do not call such a function in the example 
you gave above, do you?

Uwe Ligges
4 days later
#
Hi Jonas, hi the list
I am a bit surprise by this answer since I found in writing R extentions,
that lazydata is ignore since version 2.14.
But I have the same problem, I do not manage to export contants. So how can
I do that? 

My constant is MAX_CLUST <- 26. 

Shall I define it in a code in the /R/ directories, or in a /data/
directories? I try both, neither works...
Shall I mention it in NAMESPACE? How? 
Is there a way to make this constant available as soon as the package will
be loaded without using data()?

Thanks
Christophe

--
View this message in context: http://r.789695.n4.nabble.com/R-package-dev-how-to-export-constant-tp4305281p4326840.html
Sent from the R help mailing list archive at Nabble.com.
#
On 25.01.2012 11:17, cgenolin wrote:
LazyLoad is ignored, LazyData is not.
Either in Data and say
LazyData: yes

or in the code and export the object from the NAMESPACE, if you need it 
outside the NAMESPACE.

Since the constant from above is probbaly only used within the 
NAMESPACE; I'd define it in the ./R/ folder in an .R file without 
exporting it form the NAMESPACE.

Uwe Ligges
#
It works, thanks a lot.
No, I am write four package. The first is "all the tools" used by the 
three others. It includes the constants, so the others needs to "see" 
them.