[Bioc-devel] IntAE buffers needs to be freed or not??

2013-07-19 Thread Ge Tan
Hi all,

I am using the IntAE buffers (taken from IRanges packages) in my .Call() code.
Sample code in C:

IntAE width_buf;
width_buf = new_IntAE(0, 0, 0);
for(…){
    IntAE_insert_at(width_buf, IntAE_get_nelt(width_buf), width);
}
PROTECT(width = new_INTEGER_from_IntAE(width_buf));
UNPROTECT(1);
return(width);

So after using .Call(), do I need to run something like .Call(AEbufs_free, 
PACKAGE=IRanges) in R?
I got this from the IRanges/src/AEbufs.c.

Thanks!
Ge
___
Bioc-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/bioc-devel


Re: [Rd] R CMD check --outdir=path gives unknown option '--outdir'

2013-07-19 Thread Scott Kostyshak
On Thu, Apr 4, 2013 at 2:06 PM, Henrik Bengtsson h...@biostat.ucsf.edu wrote:
 For 'R CMD check', it appears that option '--outdir' is not recognized
 and generates warning unknown option '--outdir'. R CMD check --help
 says:

 Usage: R CMD check [options] pkgs
 [...]
 Options:
 [...]
   -o, --outdir=DIR  directory used for logfiles, R output, etc.
 (default is 'pkg.Rcheck' in current directory,
 where 'pkg' is the name of the package checked)

 Example:

 mkdir foo

 # Check output is written to foo/
 R CMD check -o foo pkg_0.1.tar.gz

 # Option is ignored and check output is written to bar.Rcheck/
 R CMD check --outdir=foo pkg_0.1.tar.gz
 Warning: unknown option '--outdir=foo'

 # Also tried with:
 R CMD check --outdir foo pkg_0.1.tar.gz
 Warning: unknown option '--outdir'

 R CMD check -outdir=foo pkg_0.1.tar.gz
 Warning: unknown option '-outdir=foo'

 R CMD check -outdir foo pkg_0.1.tar.gz
 Warning: unknown option '-outdir'

 I get this with:

 sessionInfo()
 R version 3.0.0 (2013-04-03)
 Platform: x86_64-w64-mingw32/x64 (64-bit)

 sessionInfo()
 R Under development (unstable) (2013-04-02 r62479)
 Platform: x86_64-w64-mingw32/x64 (64-bit)

 sessionInfo()
 R version 2.15.3 (2013-03-01)
 Platform: x86_64-unknown-linux-gnu (64-bit)

I see the same behavior on 3.0.1 (pre-compiled binaries on Ubuntu
12.04 and 13.04).

 sessionInfo()
R version 3.0.1 (2013-05-16)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8   LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=C LC_NAME=C
 [9] LC_ADDRESS=C   LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base

 Should I report this to http://bugs.r-project.org/?

Did you? If not, please do (or tell me to if you don't have time). I
see nothing in News.Rd on trunk.

Scott


--
Scott Kostyshak
Economics PhD Candidate
Princeton University

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


Re: [Rd] R CMD check --outdir=path gives unknown option '--outdir'

2013-07-19 Thread Prof Brian Ripley
So please follow the posting guide at 
http://www.r-project.org/posting-guide.html, to wit


'f you are using an old version of R and think it does not work 
properly, upgrade to the latest version and try that, before posting. If 
possible, try the current R-patched or R-devel version of R (see the FAQ 
for details), to see if the problem has already been addressed.'


It has been.


On 19/07/2013 07:54, Scott Kostyshak wrote:

On Thu, Apr 4, 2013 at 2:06 PM, Henrik Bengtsson h...@biostat.ucsf.edu wrote:

For 'R CMD check', it appears that option '--outdir' is not recognized
and generates warning unknown option '--outdir'. R CMD check --help
says:

Usage: R CMD check [options] pkgs
[...]
Options:
[...]
   -o, --outdir=DIR  directory used for logfiles, R output, etc.
 (default is 'pkg.Rcheck' in current directory,
 where 'pkg' is the name of the package checked)

Example:

mkdir foo

# Check output is written to foo/
R CMD check -o foo pkg_0.1.tar.gz

# Option is ignored and check output is written to bar.Rcheck/
R CMD check --outdir=foo pkg_0.1.tar.gz
Warning: unknown option '--outdir=foo'

# Also tried with:
R CMD check --outdir foo pkg_0.1.tar.gz
Warning: unknown option '--outdir'

R CMD check -outdir=foo pkg_0.1.tar.gz
Warning: unknown option '-outdir=foo'

R CMD check -outdir foo pkg_0.1.tar.gz
Warning: unknown option '-outdir'

I get this with:


sessionInfo()

R version 3.0.0 (2013-04-03)
Platform: x86_64-w64-mingw32/x64 (64-bit)


sessionInfo()

R Under development (unstable) (2013-04-02 r62479)
Platform: x86_64-w64-mingw32/x64 (64-bit)


sessionInfo()

R version 2.15.3 (2013-03-01)
Platform: x86_64-unknown-linux-gnu (64-bit)


I see the same behavior on 3.0.1 (pre-compiled binaries on Ubuntu
12.04 and 13.04).


sessionInfo()

R version 3.0.1 (2013-05-16)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
  [1] LC_CTYPE=en_US.UTF-8   LC_NUMERIC=C
  [3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8
  [5] LC_MONETARY=en_US.UTF-8LC_MESSAGES=en_US.UTF-8
  [7] LC_PAPER=C LC_NAME=C
  [9] LC_ADDRESS=C   LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base


Should I report this to http://bugs.r-project.org/?


Did you? If not, please do (or tell me to if you don't have time). I
see nothing in News.Rd on trunk.

Scott


--
Scott Kostyshak
Economics PhD Candidate
Princeton University

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




--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

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


Re: [Rd] R CMD check --outdir=path gives unknown option '--outdir'

2013-07-19 Thread Scott Kostyshak
On Fri, Jul 19, 2013 at 3:04 AM, Prof Brian Ripley
rip...@stats.ox.ac.uk wrote:
 So please follow the posting guide at
 http://www.r-project.org/posting-guide.html, to wit

 'f you are using an old version of R and think it does not work properly,
 upgrade to the latest version and try that, before posting. If possible, try
 the current R-patched or R-devel version of R (see the FAQ for details), to
 see if the problem has already been addressed.'

OK.

 It has been.

Thanks,

Scott


--
Scott Kostyshak
Economics PhD Candidate
Princeton University

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


[Rd] Posting Guide: changed link and other comment

2013-07-19 Thread Scott Kostyshak
I have two comments regarding the Posting Guide:

(1) The link in the following sentence did not work for me:

Take care when you quote other people's comments to respect their
rights, e.g., as summarized here[a].

[a] http://www.jiscmail.ac.uk/help/policy/copyright.htm

Has it been changed to the following?
  http://www.jiscmail.ac.uk/policyandsecurity/copyrightissues.html

(2) Regarding the following extract

  `If you feel insulted by some response to a post of yours, don't
make any hasty response in return - you're as likely as not to regret
it.'

wouldn't someone who is `as likely as not to regret it' be indifferent
between sending a hasty response and not sending a hasty response? The
intent is perfectly clear but perhaps `you're _more_ likely than not'
is a more probabilistically correct expression?

Thanks for the helpful document -- it is useful reading for this list
as well as more generally.

Scott


--
Scott Kostyshak
Economics PhD Candidate
Princeton University

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


[Rd] Problem with distributing data in package.

2013-07-19 Thread Simon Knapp
Hi List,

I am building a package for a client to help them create and perform
analyses against netcdf files which contain 'a temporal stack' of
grids.

For my examples and test cases, I create an example dataset in code
(as this is a lot more space efficient than providing raw data). The
code creates a netcdf file in tempdir() and an object of class 'ncdf'
in the global namespace. I have placed the code in a .R file in the
data directory of my package and 'load' it with a call to data().

My problem
-
When I build the package, the code gets executed during the build
process, the netcdf file gets created in tempdir() and the 'ncdf'
object gets saved to a .rda file in the package... which is not very
useful, since when I call data() the object gets loaded but the netcdf
file is not present (further, the 'ncdf' object includes the path to
the netcdf file - in my tempdir()).

My question
--
Is there a way to circumvent the creation of the .rda file and build
the package such that it contains the .R files instead (I note that
this is what appears to happen with a binary build for windows)? If
not, then is there another 'R-ish' way to achieve a similar result?

Just in case it is useful, I have included the code I use to build the
netcdf file and 'ncdf' object below.

Thanks in advance,
Simon Knapp


#--R code starts here--
# create a netcdf file holding a 'temporal stack'
combined.ncdf - with(new.env(), {
require(ncdf)
nLat - 7
nLon - 8
nTime - 9
missing.val - -999
filename - file.path(tempdir(), 'combined_d6fg4s64s6g4l.nc')
lat.dim - dim.def.ncdf('lat', 'degrees', 1:nLat)
lon.dim - dim.def.ncdf('lon', 'degrees', 1:nLon)
time.dim - dim.def.ncdf(time, days since 1970-01-01,
as.integer(1:nTime), unlim=T)
var.def - var.def.ncdf('Data', 'mm', list(lon.dim, lat.dim,
time.dim), missing.val, prec='single')
nc - create.ncdf(filename, var.def)
for(i in 1:nLon)
for(j in 1:nLat)
for(k in 1:nTime)
put.var.ncdf(nc, var.def, i + j*10 + k*100, c(i, j,
k), rep(1, 3))
close.ncdf(nc) # seems to be required.
open.ncdf(filename)
})

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