Displaying 20 results from an estimated 10000 matches similar to: "hook for when R quits"
2012 May 02
6
Quickest way to make a large "empty" file on disk?
R-helpers:
What would be the absolute fastest way to make a large "empty" file (e.g.
filled with all zeroes) on disk, given a byte size and a given number
number of empty values. I know I can use writeBin, but the "object" in
this case may be far too large to store in main memory. I'm asking because
I'm going to use this file in conjunction with mmap to do parallel
2013 Nov 06
1
How to do package cleanup: hooks .onUnload, R_unload_mylib, .onDetach are not called on quit
Hi,
it seems that the package hooks .onLoad and its C++ pendant
R_unload_mylib are actually not called when R quits, but only when
explicitly calling detach('package:mylib', unload = TRUE).
Maybe this is platform specific, I'm on Ubuntu 13.10 - R 3.0.2 (see below).
* is there a mechanism that a package can use to effectively do some
cleanup on standard exit, such as calling
2010 Sep 16
1
Possible bug or annoyance with library.dynam.unload()
Hello,
I have a package with a namespace. Because I use Roxygen that overwrites the
NAMESPACE file each time it is run, I use a R/zzz.R file with
an .onLoad() and .onUnload() functions to take care of loading and unloading
my shared library.
The problem: if I load my library from a local directory, then the unloading
of the package fails, e.g:
# loads fine
>library(Foo,
2006 Feb 08
2
Using .onUnload() to unload compiled code
If one wants to unload compiled code for a package containing a namespace, my understanding is that .onUnload() should be used, with a call to library.dynam.unload(). This is used in e.g., the stats and methods packages, but it appears to me that the compiled code is not being unloaded when the package is detached(). Am I misunderstanding something?
Best,
Jim
> search()
[1]
2011 Aug 30
2
Non-GPL C (or R) inside of a package
R-devel,
I am interested in creating a package that requires non-GPL'd (commercial) C
code to work. In essence it is a single .c file with no use of R headers
(all .C callable functions). For example's sake:
1 #include <stdio.h>
2
3 void test (int *a) {
4 *a = 101;
5 }
The package isn't destined for CRAN, and I realize that this isn't R-legal,
but looking for
2012 Jul 24
1
Using .onUnload to unload DLLs
I've noticed that many of the "base" R packages have an .onUnload()
function which automatically unloads compiled shared libraries
with library.dynam.unload(). For example:
> stats:::.onUnload
function (libpath)
library.dynam.unload("stats", libpath)
<bytecode: 0x1033b9c30>
<environment: namespace:stats>
I've noticed that many other packages don't
2011 Oct 18
9
readRDS and saveRDS
Hi all,
Is there any chance that readRDS and saveRDS might one day become
read.rds and write.rds? That would make them more consistent with the
other reading and writing functions.
Hadley
--
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/
2013 Jan 03
1
formal vs. passed args: parent.frame() behavior.
Happy 2013, Day 2.
I can't seem to figure out why parent.frame() works differently depending
on whether it is a formal/default argument or a passed argument.
##### code: basic setup ####
tmp <- tempfile()
A <- 101
save(A,file=tmp);rm(A)
# these work as expected, loading into the parent of the call load()
load(tmp);str(A);rm(A)
load(tmp, parent.frame());str(A);rm(A)
load(tmp,
2011 Feb 04
1
matching symbols to objects
Hello,
I'm trying to access an object, given only its name as a symbol. I cannot
figure out how to proceed. Suppose I call substitute( ) on the expression
'x + 2':
> parse.tree <- substitute(x + 2);
The constituents of parse.tree are of type symbol and numeric:
> str(parse.tree[[1]])
symbol +
> str(parse.tree[[2]])
symbol x
> str(parse.tree[[3]])
num 2
Suppose
2012 Feb 10
1
which R package is used for browsing web pages through coding
i know RCurl pakage to retrieve web content,it has limited use, i want
interactive package like
(in perl--->Mechanize,
In java--->Watij,Prowser,HTMLunit,HTTPunit,
in Ruby---->Watir ,etc)
this modules/packages opens appropriate browser,which can create
queries,retrieves output, clicks buttons, fill up form
automatically,searches keyword in search engine, Downloads many items from
2010 Nov 12
1
unloading compiled code.
I have a package that I'm developing that I need to unload the
library. Long story short I figured out that the leaving the compiled
code loaded lead to a segmentation fault, but unloading the code will
fix it. I've read the documentation and it appears that there are
several ways to do this? What is the popper accepted current standard
for unloading compiled code?
The options as I
2011 Feb 04
2
Strange behaviour of read and writeBin
To me it seems like writeBin() writes one char/byte more than expected.
> con <- file("testbin", "wb")
> writeBin("ttccggaa", con)
> close(con)
> con <- file("testbin", "rb")
> readBin(con, what="character")
[1] "ttccggaa"
> seek(con, what=NA)
[1] 9
> close(con)
> con <-
2012 Mar 01
2
Julia
My purpose in mentioning the Julia language (julialang.org) here is
not to start a flame war. I find it to be a very interesting
development and others who read this list may want to read about it
too.
It is still very much early days for this language - about the same
stage as R was in 1995 or 1996 when only a few people knew about it -
but Julia holds much potential. There is a thread about
2008 Apr 24
4
Scriptaculous Help (page exit effects)
I was wondering if it was possible in Prototype/Scriptaculous to run
an effect when a link is clicked, then go to that page, or if it was
possible to have an effect run when the page unloads.
I have tried <body onunload="new Effect.Fade("whatever");> and some
prototype page exit events, could get a alert("") function to work,
but not the effects. Any ideas?
2016 Mar 25
1
library.dynam.unload
The survival package has a firstlib.R file that I had forgotton and just reviewed. After
deleting several bits which had a use 10 years ago during my Splus to R transition, the
only thing remaining is
.onUnload <- function(libpath)
library.dynam.unload("survival", libpath)
Does this bit of code still serve a purpose? Can I toss it?
Terry T.
2009 Mar 31
4
what is the preferred method to create a package local variable?
for the moment, I'm using:
.onAttach <- function(libname, pkgname) {
.bbg.db.conn <<- dbConnect(dbDriver("PostgreSQL"), user="blah","blah")
}
.onUnload <- function(libpath) {
dbDisconnect(.bbg.db.conn)
}
which results in a hidden global variable in the global environment.
I would prefer to make the assignment only in the package namespace.
2012 Jan 31
3
seq.Date bug?
R> seq(as.Date(Sys.Date()), by="-1 months", length=6)
[1] "2012-01-31" "2011-12-31" "2011-12-01" "2011-10-31" "2011-10-01" "2011-08-31"
R>
Notice how October appears twice.
Now, date arithmetic is gruesome but the documentation for seq.Date et al
does not hint it wouldn't honour the by= argument. So a bug, or
2011 Apr 26
1
help.request() for packages?
Hi,
Have I missed something, or misunderstood?
The r-help posting guide asks users to contact the package maintainer :
"If the question relates to a contributed package, e.g., one
downloaded from CRAN, try contacting the package maintainer first.
[snip] ONLY [only is bold font] send such questions to R-help or R-devel
if you get no reply or need further assistance. This applies to both
2011 Sep 23
2
Issue with seek() on gzipped connections in R-devel
Dear all,
In R-devel (2011-09-23 r57050), I'm running into a serious problem
with seek()ing on connections opened with gzfile(). A warning is
generated and the file position does not seek to the requested
location. It doesn't seem to occur all the time - I tried to create a
small example file to illustrate it, but the problem didn't occur.
However, it can be seen with a file I use for
2008 Jan 12
2
XiphQT OggImport component on OS X link error
I am trying to build the OggImport component using Xcode 3.0. Since I
am a fan of frameworks, I have the XIPHQT_USE_FRAMEWORKS define set.
Anyhow, I am getting a link error as listed below.
Ld /Users/jeff/programming/xiph-qt/OggImport/build/Development/
OggImport.component/Contents/MacOS/OggImport normal i386
cd /Users/jeff/programming/xiph-qt/OggImport
/Developer/usr/bin/gcc-4.0