[R] Package seems to be present but library don't find it

Marc Girondot marc_grt at yahoo.fr
Tue Apr 3 10:55:39 CEST 2012


Hi,

I try to make my first package? The HelloWorld.R file is:
#### HelloWorld.R ####
#' showHello est une fonction R permettant d'afficher le message
#' "Hello World!" sur la console.
#' @title la fonction showHello()

showHello <-function(){
cat("Hello World!\n")
}

I use the following procedure to get the tar:

# set the working directory where the file is located
 > setwd("...")

 > package.skeleton("HelloWorld",code_files=c("HelloWorld.R"))

# to generate .rd files
 > library("roxygen2")
 > roxygenize("HelloWorld",copy.package=FALSE)

 > system("R CMD build '/Users/marcgirondot/Documents/Espace de travail 
R/Phenology/Source fit/Essai_package/HelloWorld'")
* checking for file ‘/Users/marcgirondot/Documents/Espace de travail 
R/Phenology/Source fit/Essai_package/HelloWorld/DESCRIPTION’ ... OK
* preparing ‘HelloWorld’:
* checking DESCRIPTION meta-information ... OK
* checking for LF line-endings in source and make files
* checking for empty or unneeded directories
Removed empty directory ‘HelloWorld/inst’
* building ‘HelloWorld_1.0.tar.gz’


 > install.packages("/Users/marcgirondot/Documents/Espace\ de\ travail\ 
R/Phenology/Source\ fit/Essai_package/HelloWorld_1.0.tar.gz", repos = NULL)
Installing package(s) into 
‘/Library/Frameworks/R.framework/Versions/2.14/Resources/library’
(as ‘lib’ is unspecified)

 > library("HelloWorld")
Erreur dans library("HelloWorld") :
‘HelloWorld’ n'est pas un nom correct de package installé

Whereas the Helloworld folder is available in the library folder with 
other packages
/Library/Frameworks/R.framework/Versions/2.14/Resources/library/HelloWorld


-- 
__________________________________________________________
Marc Girondot, Pr

Laboratoire Ecologie, Systématique et Evolution
Equipe de Conservation des Populations et des Communautés
CNRS, AgroParisTech et Université Paris-Sud 11 , UMR 8079
Bâtiment 362
91405 Orsay Cedex, France

Tel:  33 1 (0)1.69.15.72.30   Fax: 33 1 (0)1.69.15.73.53
e-mail: marc.girondot at u-psud.fr
Web: http://www.ese.u-psud.fr/epc/conservation/Marc.html
Skype: girondot



More information about the R-help mailing list