[Rd] Problem to execute a function loading by my package that I created

2011-06-02 Thread Po
Hello,

I'm a beginner on R.

I should create a package on R. The name of my package is SGeMS.
In my package, I have a big program writed in C++. This program compiles in
C++. I put this program in SGeMS/src.
In my program, I added a header file and a source file named respectively
CreateFile.h and CreateFile.cpp.
CreateFile contains 5 functions : File, FileGeneral, FileData, FileVariogram
and FileDistribution.

I use the package Rcpp to compile this. So in CreateFile.h, I added
'RcppExport' in front of all the functions.
I compiled my package with R CMD INSTALL SGeMS. The compilation works.

In R, I put :
> library("SGeMS")
Loading required package: Rcpp
> is.loaded("File")
[1] TRUE
> is.loaded("FileGeneral")
[1] TRUE
> is.loaded("FileData")
[1] TRUE
> is.loaded("FileVariogram")
[1] TRUE
> is.loaded("FileDistribution")
[1] TRUE
> FileGeneral("parameters.par",general,3.0)
Error in .Call("FileGeneral", NameFile, general, SK_mean, PACKAGE = "SGeMS")
: 
  C symbol name "FileGeneral" not in DLL for package "SGeMS"

So I have a mistake. But I didn't know why.
Is it possible to put folders and subfolders in /src ?

Awaiting reply,

Pauline

--
View this message in context: 
http://r.789695.n4.nabble.com/Problem-to-execute-a-function-loading-by-my-package-that-I-created-tp3568081p3568081.html
Sent from the R devel mailing list archive at Nabble.com.

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] [R-SIG-Mac] check leads to .o files and to packagename-Ex.R

2011-06-02 Thread Ben Bolker
On 06/02/2011 06:47 AM, Benilton Carvalho wrote:
> 'R CMD check' should be applied on the .tar.gz, not on the source directory.

  Why?  The help says: "Check R packages from package sources, which can
be directories or package 'tar' archives with extension '.tar.gz',
'.tar.bz2' or '.tgz'."  I just skimmed through the relevant section
(1.3.1) in the R Extensions manual, and it doesn't say anything about
running on tarballs being preferred.

  Add my vote to the wishlist that the src directory should get cleaned
after R CMD check.

  Ben Bolker

> 
> So, it'd be something like:
> 
> R CMD build pkg
> R CMD check pkg_version.tar.gz
> 
> b



> 
> On 2 June 2011 06:54, Marius Hofert  wrote:
>> Dear expeRts,
>>
>> I work on the R package "nacopula" 
>> (https://r-forge.r-project.org/projects/nacopula/) under Mac OS X 10.6.7 
>> (MacBook Pro). The session info is:
>> R version 2.14.0 Under development (unstable) (2011-05-02 r55730)
>> Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)
>>
>> When I apply "R CMD check nacopula" my source directory is filled with .o 
>> files (which leads to
>> a warning for the next check). Further, if I use R 2.14.0, the check 
>> produces a file "nacopula-Ex.R"
>> on the top level, i.e., where folders like R, src, tests, man, inst, and 
>> demo reside.
>> Shouldn't the source directory stay nice-and-clean, without being filled 
>> with .o
>> files and example files?
>>
>> Cheers,
>>
>> Marius
>>
>> Attachment: screen shot
>>
>>
>> ___
>> R-SIG-Mac mailing list
>> r-sig-...@r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>>
>>
> 
> 
>

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] [R-SIG-Mac] check leads to .o files and to packagename-Ex.R

2011-06-02 Thread Duncan Murdoch

On 11-06-02 9:06 AM, Ben Bolker wrote:

On 06/02/2011 06:47 AM, Benilton Carvalho wrote:

'R CMD check' should be applied on the .tar.gz, not on the source directory.


   Why?


Because that is what you will send to others.  The reason to check a 
directory instead of a tar file is to save time:  you don't need to 
recompile all the files, as a normal check does.


  The help says: "Check R packages from package sources, which can

be directories or package 'tar' archives with extension '.tar.gz',
'.tar.bz2' or '.tgz'."  I just skimmed through the relevant section
(1.3.1) in the R Extensions manual, and it doesn't say anything about
running on tarballs being preferred.

   Add my vote to the wishlist that the src directory should get cleaned
after R CMD check.


Then the advantage of checking a directory would be lost.

Duncan Murdoch



   Ben Bolker



So, it'd be something like:

R CMD build pkg
R CMD check pkg_version.tar.gz

b






On 2 June 2011 06:54, Marius Hofert  wrote:

Dear expeRts,

I work on the R package "nacopula" 
(https://r-forge.r-project.org/projects/nacopula/) under Mac OS X 10.6.7 (MacBook Pro). 
The session info is:
R version 2.14.0 Under development (unstable) (2011-05-02 r55730)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)

When I apply "R CMD check nacopula" my source directory is filled with .o files 
(which leads to
a warning for the next check). Further, if I use R 2.14.0, the check produces a file 
"nacopula-Ex.R"
on the top level, i.e., where folders like R, src, tests, man, inst, and demo 
reside.
Shouldn't the source directory stay nice-and-clean, without being filled with .o
files and example files?

Cheers,

Marius

Attachment: screen shot


___
R-SIG-Mac mailing list
r-sig-...@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-mac








__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] [R-SIG-Mac] check leads to .o files and to packagename-Ex.R

2011-06-02 Thread Ben Bolker
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 06/02/2011 09:12 AM, Duncan Murdoch wrote:
> On 11-06-02 9:06 AM, Ben Bolker wrote:
>> On 06/02/2011 06:47 AM, Benilton Carvalho wrote:
>>> 'R CMD check' should be applied on the .tar.gz, not on the source
>>> directory.
>>
>>Why?
> 
> Because that is what you will send to others.  The reason to check a
> directory instead of a tar file is to save time:  you don't need to
> recompile all the files, as a normal check does.
> 
>   The help says: "Check R packages from package sources, which can
>> be directories or package 'tar' archives with extension '.tar.gz',
>> '.tar.bz2' or '.tgz'."  I just skimmed through the relevant section
>> (1.3.1) in the R Extensions manual, and it doesn't say anything about
>> running on tarballs being preferred.
>>
>>Add my vote to the wishlist that the src directory should get cleaned
>> after R CMD check.
> 
> Then the advantage of checking a directory would be lost.
> 
> Duncan Murdoch

  OK, that makes sense.  The logic was not clear to me.
  Do you know offhand if R CMD check uses "make"-like logic to determine
whether the sources should be recompiled even if there are existing
.o/.so files, or is that up to the user ... ?

  Ben
> 
>>
>>Ben Bolker
>>
>>>
>>> So, it'd be something like:
>>>
>>> R CMD build pkg
>>> R CMD check pkg_version.tar.gz
>>>
>>> b
>>
>>
>>
>>>
>>> On 2 June 2011 06:54, Marius Hofert  wrote:
 Dear expeRts,

 I work on the R package "nacopula"
 (https://r-forge.r-project.org/projects/nacopula/) under Mac OS X
 10.6.7 (MacBook Pro). The session info is:
 R version 2.14.0 Under development (unstable) (2011-05-02 r55730)
 Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)

 When I apply "R CMD check nacopula" my source directory is filled
 with .o files (which leads to
 a warning for the next check). Further, if I use R 2.14.0, the check
 produces a file "nacopula-Ex.R"
 on the top level, i.e., where folders like R, src, tests, man, inst,
 and demo reside.
 Shouldn't the source directory stay nice-and-clean, without being
 filled with .o
 files and example files?

 Cheers,

 Marius

 Attachment: screen shot


 ___
 R-SIG-Mac mailing list
 r-sig-...@r-project.org
 https://stat.ethz.ch/mailman/listinfo/r-sig-mac


>>>
>>>
>>>
>>
>> __
>> R-devel@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
> 

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk3nmqcACgkQc5UpGjwzenOP7wCeJ/qoUed60giuBeBrJm3jiHhm
DRUAoIXl8cZE9f3TMpJ909puSgSgE8ZJ
=9zaZ
-END PGP SIGNATURE-

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] [R-SIG-Mac] check leads to .o files and to packagename-Ex.R

2011-06-02 Thread Duncan Murdoch

On 02/06/2011 10:13 AM, Ben Bolker wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 06/02/2011 09:12 AM, Duncan Murdoch wrote:
>  On 11-06-02 9:06 AM, Ben Bolker wrote:
>>  On 06/02/2011 06:47 AM, Benilton Carvalho wrote:
>>>  'R CMD check' should be applied on the .tar.gz, not on the source
>>>  directory.
>>
>> Why?
>
>  Because that is what you will send to others.  The reason to check a
>  directory instead of a tar file is to save time:  you don't need to
>  recompile all the files, as a normal check does.
>
>The help says: "Check R packages from package sources, which can
>>  be directories or package 'tar' archives with extension '.tar.gz',
>>  '.tar.bz2' or '.tgz'."  I just skimmed through the relevant section
>>  (1.3.1) in the R Extensions manual, and it doesn't say anything about
>>  running on tarballs being preferred.
>>
>> Add my vote to the wishlist that the src directory should get cleaned
>>  after R CMD check.
>
>  Then the advantage of checking a directory would be lost.
>
>  Duncan Murdoch

   OK, that makes sense.  The logic was not clear to me.
   Do you know offhand if R CMD check uses "make"-like logic to determine
whether the sources should be recompiled even if there are existing
.o/.so files, or is that up to the user ... ?


It uses make, with some cleverly written default rules.  For Windows, 
that's GNU make, but other systems might have a different make involved.


Duncan Murdoch

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] possibly invalid assertion in setRefClass?

2011-06-02 Thread John Chambers
Right, but Michael's point is valid.  It's the standard bug from having 
to explicitly check for a non-empty list before taking names(x).


Will fix.  Thanks for the catch.

John

On 6/1/11 9:21 AM, William Dunlap wrote:

-Original Message-
From: r-devel-boun...@r-project.org
[mailto:r-devel-boun...@r-project.org] On Behalf Of Michael Lawrence
Sent: Wednesday, June 01, 2011 9:15 AM
To: r-devel@r-project.org
Subject: [Rd] possibly invalid assertion in setRefClass?


setRefClass("Foo", fields = list())

Error in setRefClass("Foo", fields = list()) :
   A list argument for fields must have nonempty names for all
the fields

In my opinion, the above should not fail. There are no fields.


You can work around it by attaching an empty names attribute
to fields:
   >  setRefClass("Foo", fields = structure(list(), names=character()))
   Generator object for class "Foo":

   No fields defined

Class Methods:
   "callSuper", "copy", "export", "field", "getClass", "getRefClass",
"import", "initFields"


Reference Superclasses:
   "envRefClass"

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com




Thanks,
Michael

[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel



__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel



__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel