Hi all, I am trying to package a library in R 1.6.1 (Windoze XP). I have read the document "Writing R extensions" and think I have done things correctly (though apparently not). I have searched the mail archives for help to no avail. When I try to attach the library using, eg > library( libname, lib.loc=path.to.library) I get this message: Warning message: NAs introduced by coercion and the library does not work. Points to note: * I have no FORTRAN, only R code (getting FORTRAN working is the next project...! Stay tuned!) * If I simply source the R code, the functions all work with no problems. So at present I am just sourcing the R code that is living in the R directory of my library and using it with no problems. This seems to suggest that the R code is not at fault since I am using the same R code that the library would use. I can't figure out where or why NAs need to be introduced (by coercion or otherwise!). What is the reason, where is it happening and why, and what is the solution? Any help much appreciated. Thanks as always. P. Dr Peter Dunn (USQ CRICOS No. 00244B) Web: http://www.sci.usq.edu.au/staff/dunn Email: dunn @ usq.edu.au <Insert favourite worthless disclaimer here>
Loading libraries: Nas introduced
2 messages · Peter Dunn, Peter Dalgaard
"Peter Dunn" <dunn at usq.edu.au> writes:
Hi all, I am trying to package a library in R 1.6.1 (Windoze XP). I have read the document "Writing R extensions" and think I have done things correctly (though apparently not). I have searched the mail archives for help to no avail. When I try to attach the library using, eg
> library( libname, lib.loc=path.to.library)
I get this message: Warning message: NAs introduced by coercion and the library does not work. Points to note: * I have no FORTRAN, only R code (getting FORTRAN working is the next project...! Stay tuned!) * If I simply source the R code, the functions all work with no problems. So at present I am just sourcing the R code that is living in the R directory of my library and using it with no problems. This seems to suggest that the R code is not at fault since I am using the same R code that the library would use. I can't figure out where or why NAs need to be introduced (by coercion or otherwise!). What is the reason, where is it happening and why, and what is the solution?
Hmm... that Warning message could come from lots of things -- as.numeric(c(1,2,"a")) is prototypical. First, did you install the package properly? Rcmd INSTALL, etc. I see three places where things could go wrong: 1. in the library() function itself 2. while sourcing /path/to/yourlibrary/yourpackage/R/yourpackage 3. during .First.lib processing if /path/to/yourlibrary/yourpackage/R/yourpackage has nothing but function definitions, something is structurally wrong. I think I'd try sticking in a few test printouts between the functions in that file and try to home in on the trouble spot that way.
O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907