Skip to content

Problem with package development

23 messages · Brian Ripley, steven mosher, Nipesh Bajaj +7 more

#
Actually partly I followed. Here is the more details what I have done so far:

1. Edit the help file skeletons in 'man', possibly combining help
files for multiple functions.
I have modified with following:
\name{fn1}
\alias{fn1}

\title{
A function.
}

\description{
A function.
}

\usage{
A function.
}

\arguments{
A function.
}

\value{
A function.
}

\author{
\bold{Me}
\cr
\email{Me at me.com}
}

2. Edit the exports in 'NAMESPACE', and add necessary imports.
Actually I really do not know what I would do here. In the
corresponding file, only "exportPattern("^[[:alpha:]]+")" is there.
Therefore I put that unaltered.

3. Put any C/C++/Fortran code in 'src'.
I do not have any such code

4. If you have compiled code, add a useDynLib() directive to 'NAMESPACE'.
Again I do not know what to do, so ingored this step.

5. Run R CMD build to build the package tarball.
* Run R CMD check to check the package tarball.

I did not follow this step exactly. What I done is, put 'trial3'
folder in R/R-2.13.0bin folder (after above modification), from the
R-working folder. Then just run R CMD INSTALL trial3. However
previously with this job, I could create package effectively. After
updating R to the current version my problem starts.

Those are not sufficient?

Thanks,
On Wed, Jun 1, 2011 at 1:09 AM, Duncan Murdoch <murdoch.duncan at gmail.com> wrote:
#
I have been struggling for last one hour but not yet any through.

However again I recreate the package.skeleton and run R CMD check trial3

Here are the errors:

warning in dir.create(pkgoutdir, mode = "0755"):
cannot create dir 'c:\Program files\R\R-2.13.0\bin\trial3.Rcheck',
reason .................
Error in printLog(Log, "", text, "\n"): object 'Log' not found
Execution haulted

Why I am getting this error? what is that "Log". I will really
appreciate if somebody please help me to figure out.

Thanks,
On Wed, Jun 1, 2011 at 1:20 AM, Nipesh Bajaj <bajaj141003 at gmail.com> wrote:
#
On Wed, 1 Jun 2011, Nipesh Bajaj wrote:

            
R CMD check writes a (in your case) trial3.Rcheck directory, and in 
there in file 00check.log a copy of the log.  If it cannot create 
trial3.Rcheck it cannot write the log.

I would be surprised that even on Windows Vista the message was 
literally
but if it was, blame Microsoft for their error messages.
But
is clear enough.  You need to run 'R CMD check' in your user area.
In case you did this because that is where you though 'R' was, it is 
not the correct R.exe.   You may need to add

c:\Program Files\R\R-2.13.0\bin\i386

(assuming 32-bit R) to your path.

However, your use of e.g. 'Program files' suggests you are not 
accurately transmitting the messages you got.

  
    
1 day later
#
Thanks Prof. Ripley and Duncan for your pointers. Noting down your
points I have modified my way of building package and have done
following so far:

1. In my C: drive I create one working folder naming "R_PackageBuild"
2. In R console I have written following codes:
3. then I opened cmd and wrote following:
cd C:\R_PackageBuild
Rcmd build ?binary trial1

This process halted with following error:
Error: unexpected symbol in ?tools:::.test_load_package(?trial1?,?.)?
Execution halted
ERROR: loading failed

What I have missed in this process? Can you please help me how to
solve this issue?

Thanks,

PS: I am sorry I missplet 'Program Files'. Thanks Prof. Ripley for this pointer.

On Wed, Jun 1, 2011 at 11:41 AM, Prof Brian Ripley
<ripley at stats.ox.ac.uk> wrote:
#
On 02/06/2011 2:03 PM, Nipesh Bajaj wrote:
You haven't done the manual changes required between steps 2 and 3.  
package.skeleton() creates the skeleton of a package; you run it once as 
you are starting development, the do a lot of manual updates, described 
on the ?package.skeleton help page, and in the  ?Read-and-delete-me? 
file.  Once those are done, step 3 should succeed.

Duncan Murdoch
#
What else I need to do? In the Read-and-delete-me file following steps
are asked to perform:
* Edit the help file skeletons in 'man', possibly combining help files
for multiple functions.
* Edit the exports in 'NAMESPACE', and add necessary imports.
* Put any C/C++/Fortran code in 'src'.
* If you have compiled code, add a useDynLib() directive to 'NAMESPACE'.
* Run R CMD build to build the package tarball.
* Run R CMD check to check the package tarball.

I editied the help page for fn1() function (as I already communicated
in previous mail) as follows:
\name{fn1}
\alias{fn1}

\title{
A function.
}

\description{
A function.
}

\usage{
A function.
}

\arguments{
A function.
}

\value{
A function.
}

\author{
\bold{Me}
\cr
\email{Me at me.com}
}

And regarding th Namespace file, this time I put
"package.skeleton("trial1",namespace = FALSE, code_files =
"f:/trial.r")
"

I do not have any C/C++ code so I ignored 3rd step.

then Read-and-delete-me file asking me to build the package, so in
cmd, I run following:
cd C:\R_PackageBuild
Rcmd build ?binary trial1

What I am missing in this entire process? Do you please point me?

Thanks,


On Thu, Jun 2, 2011 at 11:40 PM, Duncan Murdoch
<murdoch.duncan at gmail.com> wrote:
#
I have run R CMD check trial1 and saw an error. This says that:

* checking pdf version of manual without hyperrefs or index  ... ERROR
Re-running with no redirection of stdout/stderr.
Hmm... looks like a package
Error in texi2dvi("Rd2.tex", pdf = (out_ext == "pdf"), quiet = FALSE, :
pdflatex is not available
Error in running tools:: texi2dvi

Does this information hwlp you to suggest something? Please let me
know what else I can provide.

Thanks,
On Fri, Jun 3, 2011 at 12:00 AM, Nipesh Bajaj <bajaj141003 at gmail.com> wrote:
#
Still I am struggling to get some inputs from the experts here :(
Definitely We can shere our experiences once I am done (really, it
seems to me very hard nut to crack!) I strongly feel that related
documentations should be more Statistician-friendly, than some Engg.
guys

Thanks,
On Fri, Jun 3, 2011 at 2:55 AM, steven mosher <moshersteven at gmail.com> wrote:
#
I don't use windows, but this error message you report:
strongly indicates that you need to install pdflatex, don't you think?

If you don't have non-R code (c or fortran) you can probably get away
without having the MinGW compiler tools, but you do need the rest of
the things listed in the admin manual as required for building
packages:
http://cran.r-project.org/doc/manuals/R-admin.html#The-Windows-toolset

In addition, googling for "building R packages on Windows" turns up
very many detailed guides for going through the process, including
discussions of what additional software you need and how to install
it.

Sarah
On Thu, Jun 2, 2011 at 6:03 PM, Nipesh Bajaj <bajaj141003 at gmail.com> wrote:
#
Hi,
On Thu, Jun 2, 2011 at 11:30 AM, Nipesh Bajaj <bajaj141003 at gmail.com> wrote:
What makes you think this qualifies as "editing"?  Please read the
Writing R Extensions manual thoroughly.  If you had, you would see
that what you have written will clearly not work (though I would think
this intuitively obvious if you have ever read documentation for
R...what function is simply documented, "A function."?).  Here is a
link to the manual:

http://cran.r-project.org/doc/manuals/R-exts.html

it actually provides a wealth of information and when I was writing my
first package, I kept it open and constantly referred to it as I was
writing documentation, naming files, creating the DESCRIPTION file,
etc.  The other resource that helped me tremendously was Dr. Chambers
book Software for Data Analysis.  You might also consider downloading
the source code for a package (I just used the SoDA package) so you
have an example of how someone who knows what they are doing writes a
package.

I feel pretty strongly that:

"I strongly feel that related documentations should be more
Statistician-friendly, than some Engg. guys"

is quite an unfair statement given all the time and effort R core has
put not only into writing R, but making manuals and documentation
that, while complex at times, are extremely thorough to the point that
I, as a psychologist, with no training in computer science,
engineering, or statistics, was able to blunder my way along just by
carefully going through their work.

Best of luck to you,

Josh

  
    
#
On 03/06/11 11:33, Joshua Wiley wrote:
<SNIP>

     Huh?  What on earth are you on about?  This is just a toy example
     to get things working and in such instances a title such as ``A 
function''
     is perfectly acceptable.

     It  looks to me like the OP's editing was done adequately, and is *not*
     the source of the OP's problems.

     Sarah Goslee has already pointed out what at least one of the sources
     of his problems is.

         cheers,

             Rolf Turner
#
On Thu, Jun 2, 2011 at 4:49 PM, Rolf Turner <rolf.turner at xtra.co.nz> wrote:
Really?  R CMD check screams bloody murder at me:

Bad \usage lines found in documentation object 'fn1':
  A function.

Functions with \usage entries need to have the appropriate \alias
entries, and all their arguments documented.
The \usage entries must correspond to syntactically valid R code.
See the chapter 'Writing R documentation files' in the 'Writing R
Extensions' manual.

  
    
#
Okay, that might have been a little strong.  "screams bloody murder"
is a warning, not technically an error, and does not occur when simply
running R CMD build.  That said, the OP did mention using R CMD check
and pdflatex is not an issue when only building anyway.  Still, it is
not the cause of the earlier problems and I was probably overly harsh
and I give my sincerest apology.

Josh
#
On 03/06/11 12:16, Joshua Wiley wrote:
Apology accepted, from my corner of the forest anyhow.

     cheers,

         Rolf
#
On 02/06/2011 2:30 PM, Nipesh Bajaj wrote:
This doesn't sound very generous of me, but I'm bowing out now. I don't 
think I can help you at all.

Duncan
#
This is how strange? How and from where I would know that I need to
install something pdflatex separately? Can you point some legitimate
link which says I need to install that (like Rtools?) Even this link
'http://www.math.rug.nl/~trentelman/jacob/pdflatex/pdflatex.html' do
not provide any download link.

This is my entire PATH variable in wondows (is anything less here?)
C:\Rtools\bin;C:\Rtools\perl\bin;C:\Rtools\MinGW\bin;C:\Program
Files\R\R-2.13.0\bin\i386;C:\Program Files\Common Files\Microsoft
Shared\Windows Live;%GTK_BASEPATH%\bin;%systemroot%\system32;%systemroot%;%systemroot%\system32\wbem;c:\program
files\common files\roxio shared\10.0\dllshared\;C:\Program
Files\MATLAB71\bin\win32;C:\LINGO10\;C:\Program Files\Microsoft SQL
Server\100\DTS\Binn\;C:\Program Files\Microsoft SQL
Server\100\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files\Microsoft
SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft Visual Studio
9.0\Common7\IDE\PrivateAssemblies\;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\strawberry\c\bin;C:\strawberry\perl\site\bin;C:\strawberry\perl\bin;C:\Program
Files\Windows Live\Shared;C:\Program Files\QuickTime\QTSystem\

Where it is incomplete? All people keep on saying
I-need-to-do-something, I-need-to-do-something,
I-need-to-do-something............ but pathetic to see anybody has
been able to point specifically I-NEED-TO-DO-WHAT-THING.
On Fri, Jun 3, 2011 at 3:44 AM, Sarah Goslee <sarah.goslee at gmail.com> wrote:
#
Hi,

I use MikTeX on Windows and it works like a charm.  Here's the link:
http://www.miktex.org/  I chose it after reading the installation
manual:

http://cran.r-project.org/doc/manuals/R-admin.html

The entire thing is very helpful, but particularly note Appendix D,
where you will find that for a complete build including PDF manuals,
you will need LaTeX (MikTeX is one version), and they give a handy
example of what your path might look like.

Cheers,

Josh
On Thu, Jun 2, 2011 at 8:48 PM, Nipesh Bajaj <bajaj141003 at gmail.com> wrote:

  
    
#
On Jun 2, 2011, at 11:48 PM, Nipesh Bajaj wrote:

            
Have you studied the R Installation and Administration Manual:

Appendix D The Windows toolset  (although in some older versions it  
was Appendix E.)
See above. And drop the attitude. Note this advice is in italics:

" This appendix contains a lot of prescriptive comments. They are here  
as a result of bitter experience. Please do not report problems to the  
R mailing lists unless you have followed all the prescriptions."
#
On Thu, Jun 2, 2011 at 11:48 PM, Nipesh Bajaj <bajaj141003 at gmail.com> wrote:

        
This is what I wrote:

            
If you don't recognize the official r-project.org R-admin manual as a legitimate
link then I'm afraid I also can't help you any further since there is nothing
more legitimate than the official documentation.

Sarah
#
On Fri, Jun 3, 2011 at 11:51 AM, Sarah Goslee <sarah.goslee at gmail.com> wrote:

            
Except the source code! Possible case in point, someone on
StackOverflow was wondering why "0 <= x <= 1" isn't a valid
expression, neither in the context of what he expected (TRUE if x is
between 0 and 1) nor how I explained it would function (as (0<=x) <=
1, and then comparing a TRUE/FALSE against 1) if it were not for the
flagging of comparison operators as non-associative in gram.y in the
source code. I even recompiled R with <= as left associative to check.
Sure enough, I could then type 0 <= 5 <= 1 as a valid expression and
get TRUE returned.

 Now, the user (eventually) understood all of this, but neither he nor
I could find this documented in the R docs. Actually, it sems to
contradict the code [my **emphasis**]:

"The exponentiation operator ?^? and the left assignment operators ?<-
- = <<-? group right to left, **all other operators** group left to
right. That is, 2 ^ 2 ^ 3 is 2 ^ 8, not 4 ^ 3, whereas 1 - 1 - 1 is
-1, not 1. ".

 Shortly before that the comparison operators (>, < etc) are listed in
a table of precedence with the other operators.

 Actually I reckon this is a clear documentation bug and I should
probably report it... But its lunchtime and there's free cheese...

Barry
#
A fortunes candidate??

-- Bert

  
    
#
On 04/06/11 00:02, Barry Rowlingson wrote:
<SNIP>
So does mean that *inevitably*  trying to make "0 <= x <= 1"
syntactically valid will always lead to nonsensical results?  No way
around it?

     cheers,

         Rolf

P. S.  How was the cheese?  Was there any Cheshire?  (Almost impossible
to find in N.Z. these days.  Naturally.  It being my favourite.)

         R.