Displaying 20 results from an estimated 20000 matches similar to: "dyn.unload fails after some C++ code."
2007 Mar 11
0
Dyn.load and Unload problems
Hi,
I am trying to modify the devX11.c source in the directory R-2.4.1/
src/modules/X11.
Under OS X 10.4.9 running the R gui (R version 2.4.1) on a
Powerbook, i type this and get the subsequent error.
> dyn.unload("/Library/Frameworks/R.framework/Resources/modules/ppc/
R_X11.so")
Error in dyn.unload(x) : dynamic/shared library '/Library/Frameworks/
2004 Mar 02
3
error() and C++ destructors
Hi,
I am writing C++ functions that are to be called via .Call() interface.
I'd been using error() (from R.h) to return to R if there is an error,
but then I realized that this might be not safe as supposedly error()
doesn't throw an exception and therefore some destructors do not get
called and some memory may leak. Here is a simple example
extern "C" void foo() {
string
2001 Feb 20
0
dyn.load() and dyn.unload() under Windows
Hello:
I am having some difficulty with a DLL, using
> version
_
platform i386-pc-mingw32
arch x86
os Win32
system x86, Win32
status
major 1
minor 2.1
year 2001
month 01
day 15
language R
I have a library called
2001 Oct 27
2
"unloading" data
Dear R-Users,
I am reading the "An Introduction to R" manual and have come across data()
function for loading data.
I assume that R requires explicit loading of data objects to save memory.
Then I'd expect there should be a function that can unload the objects once
they are not needed anymore, what is this function? It would be helpful if
?data contained a reference to that
2005 Mar 08
4
how modify object in parent.env
Hi,
Is it possible to modify an object in the parent.env (as opposed to
re-bind)? Here is what I tried:
> x = 1:3
# try to modify the first element of x from within a new environment
> local(get("x", parent.env(environment()))[1] <- NA)
Error in eval(expr, envir, enclos) : Target of assignment expands to
non-language object
# On the other hand retrieval works just fine
>
2004 Dec 03
4
seq.Date requires by
Hi,
What is the reason for seq.Date to require the 'by' argument and not to
default it to 1 in the example below?
> seq(from=as.Date("1996-01-01"), to=as.Date("1996-12-01"))
Error in seq.Date(from = as.Date("1996-01-01"), to =
as.Date("1996-12-01")) :
exactly two of `to', `by' and `length.out' / `along.with' must be
specified
2003 Sep 03
3
read.table: check.names arg - feature request
Hi,
I thought it would be convenient if the check.names argument to read.table, which currently can only be TRUE/FALSE, could take a function value as well. If the function is supplied it should be used instead of the default make.names.
Here is an example where it can come in handy. I tend to keep my data in coma-separated files with a header line. The header line is prefixed with a comment
2004 May 01
5
skip lines on a connection
Hi,
I am looking for an efficient way of skipping big chunks of lines on a
connection (not necessarily at the beginning of the file). One way is to
use read lines, e.g. readLines(1e6), but a) this incurs the overhead of
construction of the return char vector and b) has a (fairly remote)
potential to blow up the memory.
Another way would be to use scan(), e.g.
scan(con, skip=1e6, nmax=0)
2004 Nov 10
3
recursive default argument reference
Hi,
It seems that a formal function argument can not default to an "outer"
variable of the same name:
> x <- "foo"
> ff <- function(x=x) x
> ff()
Error in ff() : recursive default argument reference
>
Is this intentional? Why?
I use R-1.9.1.
Thanks,
Vadim
2004 Jun 08
5
fast mkChar
Hi,
To speed up reading of large (few million lines) CSV files I am writing
custom read functions (in C). By timing various approaches I figured out
that one of the bottlenecks in reading character fields is the mkChar()
function which on each call incurs a lot of garbage-collection-related
overhead.
I wonder if there is a "vectorized" version of mkChar, say mkChar2(char
**, int
2005 May 07
4
how to add method to .Primitive function
Hi,
I tried to write the dim method for the list class, but R doesn't seem
to dispatch to it:
> dim.list = function(x) c(length(x[[1]]), length(x))
> dim(list(1))
NULL
> dim.list(list(1))
[1] 1 1
What is the correct way of registering dim.list with .Primitive("dim")?
Thanks,
Vadim
[[alternative HTML version deleted]]
2018 Mar 01
1
Repeated use of dyn.load().
Good question Rolf.
Rui, thanks for pointing out dyn.unload.
When I started using Rcpp a couple of years ago I got burned by stale .so
enough times that I adopted a policy of recompile-then-start new R session.
My workflow does not include Rolf's "brazillion" repeats, so the overhead
of this approach has not been too painful.
The documentation for dyn.unload (via ?dyn.unload)
2006 Jul 11
0
Assistance with dll's to use with dyn.load
After having browsed the documentation for a while without discovering what I am looking for, maybe one of you would know ...
What I want to do:
I have two fortran files MC.f and ESCA.f. In MC.f there is a call to a routine called lpost. This routine (lpost) is defined (among other things) in ESCA.f.
Under linux, I can do the following:
R CMD SHLIB MC.f
and
R CMD SHLIB ESCA.f
followed by
2018 Mar 01
0
Repeated use of dyn.load().
Hello,
In such cases, with C code, I call dyn.unload before loading the
modified shared lib again.
I don't know if this changed recently, but it used to be needed or else
R wouldn't load the new lib. When I call dyn.unload followed by dyn.load
I never had problems.
(Or the other way around, call dyn.unload before modifying the C code.)
Hope this helps,
Rui Barradas
On 3/1/2018 8:52
2003 May 16
1
Reloading a shared library with dyn.load
Hi,
I'm using dyn.load to load a shared library (compiled from C
code) into R. If I dyn.unload it and then dyn.load it again, I
get an hourglass icon in Rgui (R 1.7.0, Win 2000), and it
just sits there forever. I can't press Escape to stop the
current computation, but I can close Rgui without resorting to
using the Task Manager.
Is it a problem with my use of R_alloc? Do I need
2018 Mar 02
0
Repeated use of dyn.load().
I sent this enquiry to r-help and received several sympathetic replies,
none of which were definitive.
It was kindly suggested to me that I might get better mileage out of
r-devel, so I'm trying here. I hope that this is not inappropriate.
My original enquiry to r-help:
==========================================================================
I am working with a function "foo"
2005 May 06
0
FW: distance between distributions
Sorry, forgot to send this to the list originally.
-----Original Message-----
From: Mike Waters [mailto:dr.mike at ntlworld.com]
Sent: 06 May 2005 18:40
To: 'Campbell'
Subject: RE: [R] distance between distributions
-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Campbell
Sent: 06 May 2005 11:19
To:
2004 Jun 30
2
Slow IO: was [R] naive question
I believe IO in R is slow because of the way it is implemented, not
because it has to do some extra work for the user.
I compared scan() with 'what' argument set (which is, AFAIK, is the
fastest way to read a CSV file) to an equivalent C code. It turned out
to be 20 - 50 times slower.
I can see at least two main reasons why R's IO is so slow (I didn't
profile this though):
A) it
2004 Nov 26
2
Lightweight data frame class
Hi,
As far as I can tell data.frame class adds two features to those of
lists:
* matrix structure via [,] and [,]<- operators (well, I know these are
actually "["(i, j, ...), not "[,]").
* row names attribute.
It seems that the overhead of the support for the row names, both
computational and RAM-wise, is rather non-trivial. I frequently
subscript from a data.frame,
2014 Nov 11
0
Should R Packages Unload Dynamic Libraries When They Unload?
>From Hadley's C best practices (http://r-pkgs.had.co.nz/src.html#c-best-practices):
> Like with C++, whenever you use C code in your package, you should unload the DLL when the package is unloaded:
.onUnload <- function (libpath) {
library.dynam.unload("mypackage", libpath)
}
Writing R Extensions on the other hand doesn't even mention this (AFAIK). I