Re: [Rd] Bug in read.table?

2010-11-15 Thread Ben Bolker
Ben Bolker gmail.com> writes: > > Ben Bolker gmail.com> writes: > > > > > > >Can simplify this still farther: > > a b'c > d e'f > g h'i This example file leads to duplicate lines. Arguably it should have behavior analogous to: > scan(what="") 1: a b'c 3: d e'f 5: g h'i 7: Read 6 item

Re: [Rd] Trying to understand the search path and namespaces

2010-11-15 Thread Mark Leeds
Hi Duncan: Luke's article is in the June, 2003 edition of R-news On Mon, Nov 15, 2010 at 8:43 PM, Duncan Murdoch wrote: > Hadley Wickham wrote: > >> Hi all, >> >> I'm trying to understand how the search path and namespaces interact. >> For example, take the devtools package which suggests the te

Re: [Rd] Trying to understand the search path and namespaces

2010-11-15 Thread Hadley Wickham
> 1.6 of Writing R Extensions says > > Note that adding a name space to a package changes the search strategy. > The package name space comes first in the search, then the imports, then > the base name space and then the normal search path. > > I'm not sure of the details, but I think > >  parents(

Re: [Rd] Trying to understand the search path and namespaces

2010-11-15 Thread Duncan Murdoch
Hadley Wickham wrote: Hi all, I'm trying to understand how the search path and namespaces interact. For example, take the devtools package which suggests the testthat package. Here's what the search path looks like after I load each of those packages: Luke Tierney wrote up a nice description

Re: [Rd] Trying to understand the search path and namespaces

2010-11-15 Thread Martin Morgan
On 11/15/2010 04:56 PM, Hadley Wickham wrote: >> Well, that's what I thought too. But: >> >> parents <- function(x) { >> if (identical(x, emptyenv())) return() >> c(environmentName(x), parents(parent.env(x))) >> } >>> parents(as.environment("package:devtools")) >> [1] "package:devtools" "package

Re: [Rd] Trying to understand the search path and namespaces

2010-11-15 Thread Hadley Wickham
> Well, that's what I thought too.  But: > > parents <- function(x) { >  if (identical(x, emptyenv())) return() >  c(environmentName(x), parents(parent.env(x))) > } >> parents(as.environment("package:devtools")) > [1] "package:devtools" "package:methods"  "Autoloads"        "base" > > And package:t

Re: [Rd] Trying to understand the search path and namespaces

2010-11-15 Thread Hadley Wickham
> With a small risk of being incorrect (and the chance of learning > something new), I'll give it a try: > > A search for a functions/objects/... that is not in the same package > environment is done in the order that the search() path gives.  The > exception to this iff your package has a namespac

Re: [Rd] Trying to understand the search path and namespaces

2010-11-15 Thread Henrik Bengtsson
On Mon, Nov 15, 2010 at 3:26 PM, Hadley Wickham wrote: > Hi all, > > I'm trying to understand how the search path and namespaces interact. > For example, take the devtools package which suggests the testthat > package.  Here's what the search path looks like after I load each of > those packages:

[Rd] Trying to understand the search path and namespaces

2010-11-15 Thread Hadley Wickham
Hi all, I'm trying to understand how the search path and namespaces interact. For example, take the devtools package which suggests the testthat package. Here's what the search path looks like after I load each of those packages: > library(devtools) > search() [1] ".GlobalEnv""package:d

Re: [Rd] R5 reference classes: how to initialize exactly?

2010-11-15 Thread Janko Thyson
Sorry, I was stupid: MyRefObj <- setRefClass("Blabla", .) One can always get the generator object of an defined class with 'getRefClass()'. So: g <- getRefClass("Blabla") x <- g$new(.) Regards, Janko Von: Janko Thyson [mailto:janko.thy...@ku-eichstaett.de] Gesendet: Dienst

[Rd] R5 reference classes: how to initialize exactly?

2010-11-15 Thread Janko Thyson
Dear List, So far, I really like those new R5 classes. But what kind of puzzles me is that it's not just enough to define the actual reference class, I also have to assign it to an object (e.g. 'MyRefObj') in order to fire 'MyRefObj$new(.)'. S4: setClass("Blabla", .) x <- new("Blabla")

Re: [Rd] Create NAMESPACE file as 'package.skeleton()' would do

2010-11-15 Thread Hadley Wickham
If you're using roxygenise, explicitly tag functions that you want to export with @export. Hadley On Mon, Nov 15, 2010 at 5:11 PM, Janko Thyson wrote: > Hi there, > > > > is there a way to create a NAMESPACE file based on Rd-files (or whatever is > needed in order to apply the regular expression

[Rd] Create NAMESPACE file as 'package.skeleton()' would do

2010-11-15 Thread Janko Thyson
Hi there, is there a way to create a NAMESPACE file based on Rd-files (or whatever is needed in order to apply the regular expression "^[[:alpha:]]+" without(!) resorting to package.skeleton() (as this kind of interferes with roxygenize() pretty often)? Thanks a lot, Janko [[alte

Re: [Rd] SEXPs and slots

2010-11-15 Thread Patrick Leyshock
Thanks Martin and Hadley, this is very helpful. I should also add that I'm constantly reading the source code, but sometimes a response like this one can eliminate many, many hours of puzzlement. Much appreciated. Patrick On Mon, Nov 15, 2010 at 12:07 PM, Patrick Leyshock wrote: > Thanks Marti

Re: [Rd] SEXP and slots

2010-11-15 Thread Romain Francois
Hello, Since people have whisperred about Rcpp, I'd like to play too. On 11/15/2010 07:45 AM, Patrick Leyshock wrote: Very helpful, thank you. A couple other questions, please: 1. I've got a function written in C, named "my_c_function". In my R code I call this function, passing to it an I

Re: [Rd] SEXPs and slots

2010-11-15 Thread Patrick Leyshock
Thanks Martin and Hadley, this is very helpful. I should also add that I'm constantly reading the source code, but sometimes a response like this one can eliminate many, many hours of puzzlement. Much appreciated. Patrick On Mon, Nov 15, 2010 at 10:01 AM, Martin Morgan wrote: > On 11/15/2010

Re: [Rd] SEXPs and slots

2010-11-15 Thread Martin Morgan
On 11/15/2010 07:45 AM, Patrick Leyshock wrote: > Very helpful, thank you. > > A couple other questions, please: > > 1. I've got a function written in C, named "my_c_function". In my R > code I call this function, passing to it an INTSXP and a STRSXP, > respectively: > >result <- .Call("my

Re: [Rd] SEXPs and slots

2010-11-15 Thread Dirk Eddelbuettel
On 15 November 2010 at 10:46, Hadley Wickham wrote: | > 2.  Any good references/resources for developing R?  Nearly all the | > documents I've found are for programming R as a user, not as a developer.  I | > have copies of the documentation, which are very helpful, but it'd be | > helpful to have

Re: [Rd] SEXPs and slots

2010-11-15 Thread Hadley Wickham
> 2.  Any good references/resources for developing R?  Nearly all the > documents I've found are for programming R as a user, not as a developer.  I > have copies of the documentation, which are very helpful, but it'd be > helpful to have additional resources to fill in their gaps. The best advice

Re: [Rd] SEXPs and slots

2010-11-15 Thread Patrick Leyshock
Very helpful, thank you. A couple other questions, please: 1. I've got a function written in C, named "my_c_function". In my R code I call this function, passing to it an INTSXP and a STRSXP, respectively: result <- .Call("my_c_function", int_vector, str_vector) The prototype of "my_c_func

Re: [Rd] Package with multiple shared libraries

2010-11-15 Thread Prof Brian Ripley
R CMD INSTALL is R code, and you can read it for yourself rather than asking other people to do so for you. If you look in tools:::.install.packages you will see shlib_install <- function(instdir, arch) { files <- Sys.glob(paste0("*", SHLIB_EXT)) if (leng

[Rd] Package with multiple shared libraries

2010-11-15 Thread Andreas Borg
Dear R-devel members, I would like to compile a package with two seperate shared libraries. For example, in a package 'foo', a file 'bar.so' built from a distinct set of source files should be installed in addition to the default 'foo.so' (or .dll on windows). Does anyone know about a way to a