[R] Understanding contents of packages
Ista Zahn
istazahn at gmail.com
Thu Apr 11 20:49:26 CEST 2013
On Thu, Apr 11, 2013 at 2:42 PM, Fisher Dennis <fisher at plessthan.com> wrote:
> to learn how to use .C()
Have you read the manual?
http://cran.r-project.org/doc/manuals/R-exts.html#System-and-foreign-language-interfaces
Best,
Ista
> Dennis Fisher MD
> P < (The "P Less Than" Company)
> Phone: 1-866-PLessThan (1-866-753-7784)
> Fax: 1-866-PLessThan (1-866-753-7784)
> www.PLessThan.com
>
>
>
> On Apr 11, 2013, at 11:40 AM, Ista Zahn <istazahn at gmail.com> wrote:
>
>> Hi Dennis,
>>
>> Out of curiosity, what is the purpose of this exercise?
>>
>> Best,
>> Ista
>>
>> On Thu, Apr 11, 2013 at 2:34 PM, Fisher Dennis <fisher at plessthan.com> wrote:
>>> Colleagues
>>>
>>> During the transition to R3.0.0 (OS X), one of the packages that I used -- SASxport -- did not work until I used the "type=source" option in install.packages.
>>>
>>> This led to an adventure:
>>> 1. I downloaded the package source: SASxport_1.2.4.tar.gz
>>> 2. in the SASxport/R folder, I found all the functions that are part of the package.
>>> I became interested in whether I could "source" these functions directly into R and re-create the functionality of the package without installing/"require"ing the package.
>>>
>>> This started with some success until I encountered one problem that I could not overcome.
>>> When I executed the function write.xport, I received the following error message:
>>> Error in .C("fill_file_header", cDate = xport.dateFMT(cDate), mDate = xport.dateFMT(mDate), :
>>> C symbol name "fill_file_header" not in load table
>>>
>>> This appears to be coming from the following line of code in write.xport:
>>> out(xport.file.header( cDate = cDate, sasVer = sasVer, osType = osType))
>>> The problem appears to be in
>>> xport.file.header
>>> for which the entire code is:
>>>
>>> xport.file.header <-
>>> function(cDate=Sys.time(), mDate=cDate, sasVer="7.00", osType="Unknown" )
>>> {
>>> .C("fill_file_header",
>>> cDate = xport.dateFMT(cDate), # Creation date
>>> mDate = xport.dateFMT(mDate), # Modification date
>>> sasVer = toupper(as.character(sasVer)), # SAS version number
>>> osType = as.character(osType) # Operating System (can include lowercase)
>>> )
>>>
>>> .Call("getRawBuffer", PACKAGE="SASxport")
>>>
>>> }
>>>
>>> Of note, I commented out the line:
>>> .Call("getRawBuffer", PACKAGE="SASxport")
>>> and the same error occurred (I did not expect this is solve the problem).
>>>
>>> I then looked in SASxport/src and found three files (which appear to be coded in C):
>>> init.c
>>> writeSAS.c
>>> writeSAS.h
>>> that refer to "fill_file_header"
>>>
>>> I suspect that these files need to be accessed in some manner in order for xport.file.header and other functions to work correctly.
>>> The question is how do I access these files:
>>> Do I "source" them in some manner?
>>> Put them in a particular location where they are sourced automatically?
>>> I tried dyn.load but that does not appear to be the correct approach.
>>>
>>> Any help would be greatly appreciated.
>>>
>>> Thanks
>>>
>>> Dennis
>>>
>>>
>>> Dennis Fisher MD
>>> P < (The "P Less Than" Company)
>>> Phone: 1-866-PLessThan (1-866-753-7784)
>>> Fax: 1-866-PLessThan (1-866-753-7784)
>>> www.PLessThan.com
>>>
>>> ______________________________________________
>>> 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