[R] how to install a locally built package

Uwe Ligges ligges at statistik.tu-dortmund.de
Thu Oct 6 15:46:54 CEST 2011



On 06.10.2011 15:45, Bond, Stephen wrote:
> Uwe,
>
> Are u saying
> 1) I can add the new func in one of the existing .R files in the R dir??

Yes, sure, or add an additional file.

> Or
> 2) add a new .R file in the same dir and ignore the lack of a matching .Rd file?

Yes. You can also generate a single Rd file using prompt() on the function.


Uwe Ligges


>
> Thank you.
> Stephen Bond | Senior Analyst | Treasury Analytics | 416-956-3092
>
> -----Original Message-----
> From: Uwe Ligges [mailto:ligges at statistik.tu-dortmund.de]
> Sent: Thursday, October 06, 2011 9:12 AM
> To: Bond, Stephen
> Cc: r-help at r-project.org
> Subject: Re: [R] how to install a locally built package
>
>
>
> On 06.10.2011 15:10, Bond, Stephen wrote:
>> Is there a way to put all R code in a single file?
>>
>> I have too many small files now, and it is inconvenient to edit (I still have to put everything in one buffer) and when I add just one new func I have to go through the process of manually editing all help files one by one. When I put all the code in one file only the first func is loaded.
>
> He? You really do not need to edit anything when you add a function.
> Just don't use package skeleton but just add the function.
>
> Uwe Ligges
>
>
>
>>
>> Thanks everybody
>>
>> Stephen B
>>
>> -----Original Message-----
>> From: Uwe Ligges [mailto:ligges at statistik.tu-dortmund.de]
>> Sent: Friday, September 16, 2011 3:43 AM
>> To: Bond, Stephen
>> Cc: r-help at r-project.org
>> Subject: Re: [R] how to install a locally built package
>>
>>
>>
>> On 15.09.2011 20:38, Bond, Stephen wrote:
>>> I got it working by typing a string in getdfv.Rd after \title{
>>>
>>> \title{ getdf
>>> %%  ~~function to do ... ~~
>>> }
>>>
>>> Strange why the skeleton would not do that given it did \name{getdfv}
>>> \alias{getdfv}
>>
>> One reason is that we try to force people to deal with the documentation which we feel is very important, even if the stuff is just used by yourself.
>>
>> Best,
>> Uwe Ligges
>>
>>
>>>
>>> Anyway, I'm happy now.
>>>
>>> Stephen Bond
>>>
>>> -----Original Message-----
>>> From: Uwe Ligges [mailto:ligges at statistik.tu-dortmund.de]
>>> Sent: Thursday, September 15, 2011 12:15 PM
>>> To: Bond, Stephen
>>> Cc: r-help at r-project.org
>>> Subject: Re: [R] how to install a locally built package
>>>
>>>
>>>
>>> On 15.09.2011 17:47, Bond, Stephen wrote:
>>>> Uwe,
>>>>
>>>> That gave me the same error like CMD install
>>>>> install.packages("C:/Temp/mypack_1.0.tar.gz", repos=NULL,
>>>>> type="source")
>>>>
>>>> install.packages("C:/Temp/mypack_1.0.tar.gz", repos=NULL,
>>>> type="source") Loading required package: stats Loading required
>>>> package: utils Loading required package: graphics Loading required
>>>> package: splines
>>>> * installing *source* package 'mypack' ...
>>>> ** R
>>>> ** preparing package for lazy loading
>>>> ** help
>>>> Warning:
>>>> C:/DOCUME~1/BondStep/LOCALS~1/Temp/Rtmpw5N7dm/R.INSTALL6ccc14e6/mypa
>>>> c
>>>> k/man/mypack-package.Rd:33: All text must be in a section
>>>> *** installing help indices
>>>> Error in Rd_info(db[[i]]) : Rd files must have a non-empty \title.
>>>> See chapter 'Writing R documentation' in manual 'Writing R Extensions'.
>>>> * removing 'c:/PROGRA~1/R/R-212~1.1/library/mypack'
>>>> * restoring previous 'c:/PROGRA~1/R/R-212~1.1/library/mypack'
>>>> Warning message:
>>>> In install.packages("C:/Temp/mypack_1.0.tar.gz", repos = NULL, type = "source") :
>>>>       installation of package 'C:/Temp/mypack_1.0.tar.gz' had
>>>> non-zero exit status
>>>>
>>>> is there a way to skip the Rd part? This is for private use only and there is no help or data files.
>>>
>>>
>>> Then you have to delete the Rd file that has been generated by
>>> package.skeleton.
>>> Please read the manuals "Writing R Extensions" and "R Installation
>>> and Administration".
>>>
>>> Best,
>>> Uwe Ligges
>>>
>>>
>>>
>>>> Thank you.
>>>>
>>>> Stephen Bond
>>>>
>>>> -----Original Message-----
>>>> From: Uwe Ligges [mailto:ligges at statistik.tu-dortmund.de]
>>>> Sent: Thursday, September 15, 2011 11:43 AM
>>>> To: Bond, Stephen
>>>> Cc: r-help at r-project.org
>>>> Subject: Re: [R] how to install a locally built package
>>>>
>>>>
>>>>
>>>> On 15.09.2011 17:32, Bond, Stephen wrote:
>>>>> Hello useRs,
>>>>>
>>>>> I am trying to put my funcs in a package to avoid clutter in my workspace as the funcs are now in .Rprofile.
>>>>> All plain R code no compilations. Using win XP with a full cygwin
>>>>> install and R2.12 I first did
>>>>>
>>>>> package.skeleton("mypack",list="getdfv", namespace=T) # just a
>>>>> single func
>>>>>
>>>>> which created a folder with the required stuff in it.
>>>>> Calling R CMD build creates a tar.gz file with warnings about DOS paths.
>>>>>
>>>>> Trying to install from the R GUI complains
>>>>>> install.packages("mypack",repos="C:/Temp/mypack_1.0.tar.gz")
>>>>> Warning: unable to access index for repository
>>>>> C:/Temp/mypack_1.0.tar.gz/bin/windows/contrib/2.12
>>>>> Warning message:
>>>>> In getDependencies(pkgs, dependencies, available, lib) :
>>>>>        package 'mypack' is not available
>>>>
>>>>
>>>> install.packages("C:/Temp/mypack_1.0.tar.gz", repos=NULL,
>>>> type="source")
>>>>
>>>> seems to be what you want.
>>>>
>>>> Uwe Ligges
>>>>
>>>>
>>>>> putting the mypack folder in zip and then trying to install from
>>>>> the zip produces no error message but then
>>>>>
>>>>>> library("mypack")
>>>>> Error in library("mypack") : 'mypack' is not a valid installed
>>>>> package
>>>>>
>>>>> Just putting the folder in the library folder of R did not work
>>>>> either
>>>>>
>>>>> Finally
>>>>> R CMD Install complains about missing title in the Rd file. I do not have a Rd file as the skeleton did not create it.
>>>>>
>>>>> Please, advise how to make simple R code available to be called
>>>>> without showing in ls()
>>>>>
>>>>> Thank you.
>>>>> Stephen Bond
>>>>>
>>>>>
>>>>> 	[[alternative HTML version deleted]]
>>>>>
>>>>> ______________________________________________
>>>>> 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.



More information about the R-help mailing list