[R] Understanding contents of packages

Fisher Dennis fisher at plessthan.com
Thu Apr 11 20:34:05 CEST 2013


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
for which the entire code is:

xport.file.header <-
  function(cDate=Sys.time(), mDate=cDate, sasVer="7.00", osType="Unknown" )
       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):
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.



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)

More information about the R-help mailing list