[R] Problem with package development
Joshua Wiley
jwiley.psych at gmail.com
Fri Jun 3 01:33:49 CEST 2011
Hi,
On Thu, Jun 2, 2011 at 11:30 AM, Nipesh Bajaj <bajaj141003 at gmail.com> wrote:
> 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.
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
> }
>
> \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:
>> On 02/06/2011 2:03 PM, Nipesh Bajaj wrote:
>>>
>>> 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:
>>> > setwd("c:/R_packageBuild")
>>> > package.skeleton("trial1",namespace = TRUE, code_files = "f:/trial.r")
>>> 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?
>>
>> 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
>>
>>> 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 Wed, 1 Jun 2011, Nipesh Bajaj 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.
>>> >
>>> > 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
>>> >
>>> >> reason .................
>>> >
>>> > but if it was, blame Microsoft for their error messages.
>>> > But
>>> >>
>>> >> cannot create dir 'c:\Program files\R\R-2.13.0\bin\trial3.Rcheck',
>>> >
>>> > 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.
>>> >
>>> >
>>> >>
>>> >> Thanks,
>>> >>
>>> >> On Wed, Jun 1, 2011 at 1:20 AM, Nipesh Bajaj<bajaj141003 at gmail.com>
>>> >> wrote:
>>> >>>
>>> >>> 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:
>>> >>>>
>>> >>>> On 11-05-31 3:36 PM, Nipesh Bajaj wrote:
>>> >>>>>
>>> >>>>> Dear all, I am having a strage problem while I was trying to build
>>> >>>>> a
>>> >>>>> package. Here is my package skeleton:
>>> >>>>>
>>> >>>>> fn1<- Vectorize(function(x,y,z) {
>>> >>>>> return(x + y +z)
>>> >>>>> }, vectorize.args = c("x"), SIMPLIFY = TRUE)
>>> >>>>> package.skeleton("trial3",namespace = TRUE)
>>> >>>>
>>> >>>> Did you follow the instructions that package.skeleton printed?
>>> >>>>
>>> >>>> Duncan Murdoch
>>> >>>>
>>> >>>>>
>>> >>>>> However when I tun "R CMD INSTALL trial3" in CMD, the execution
>>> >>>>> stopped with following message:
>>> >>>>>
>>> >>>>> *** installing help indices
>>> >>>>> ** building package indices...
>>> >>>>> ** testing if install package can be loaded
>>> >>>>> Error: unexpected symbol in
>>> >>>>> "tools:::test_load_package(.............."
>>> >>>>> Execution haulted
>>> >>>>> ERROR: loading failed.............
>>> >>>>>
>>> >>>>> I am using R 2.13.0 in Vista with latest Rtools installed. Can
>>> >>>>> somebody guide me where I have done wrong?
>>> >>>>>
>>> >>>>> Thanks,
>>> >>>>>
>>> >>>>> ______________________________________________
>>> >>>>> R-help at r-project.org mailing list
>>> >>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> >>>>> PLEASE do read the posting guide
>>> >>>>> http://www.R-project.org/posting-guide.html
>>> >>>>> and provide commented, minimal, self-contained, reproducible code.
>>> >>>>
>>> >>>>
>>> >>>
>>> >>
>>> >> ______________________________________________
>>> >> R-help at r-project.org mailing list
>>> >> https://stat.ethz.ch/mailman/listinfo/r-help
>>> >> PLEASE do read the posting guide
>>> >> http://www.R-project.org/posting-guide.html
>>> >> and provide commented, minimal, self-contained, reproducible code.
>>> >>
>>> >
>>> > --
>>> > Brian D. Ripley, ripley at stats.ox.ac.uk
>>> > 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, UK Fax: +44 1865 272595
>>
>>
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
--
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
http://www.joshuawiley.com/
More information about the R-help
mailing list