[Rd] S4 plus

2011-04-14 Thread James Perkins
Dear all,

I set a generic s4 funciton, then add a method.

When I do this, I notice that when pressing tab, the arguments to this
method do not appear like they do for generic functions, instead I get an
elipsis.

i.e.

> setClass("batchFile")
[1] "batchFile"
>
> setGeneric("Gen1", function(batchFile, ...) standardGeneric("Gen1"))
[1] "Gen1"
>
> setMethod("Gen1", signature = "batchFile", definition =
+ function(batchFile, xxx, yyy, zzz) { return(batchFile) }
+ )
[1] "Gen1"
> Gen1(
...=batchFile=


Note that xx, yy and zzz are not displayed when pressing  after Gen1(

contrast that to

> Gen1 <- function(batchFile, xxx, yyy, zzz) { return(batchFile) }
> Gen1(
batchFile=  xxx=yyy=zzz=


Is there a way to allow  to show the extra options? Or has this been
deliberately disabled in order to allow someone to set a number of different
methods with method specific arguments with a single generic?

Many thanks,

Jim
-- 
James Perkins, PhD student
Institute of Structural and Molecular Biology
Division of Biosciences
University College London
Gower Steet
London, WC1E 6BT
UK

email: jperk...@biochem.ucl.ac.uk
phone: 0207 679 2198

[[alternative HTML version deleted]]

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


[Rd] Postscript can be very slow in R 2.13-0

2011-04-14 Thread Stephen Milborrow

Viewing certain postscript files under R 2.13-0 is very slow, at least using
GSview on my 64 bit Windows 7 system.  To see this, compare how long it 
takes to display these two files (fast.ps was created by removing the /srgb 
stuff in .ps.prolog):


   www.milbo.org/postscript/slow.ps

   www.milbo.org/postscript/fast.ps

The code to produce the above two files is here:

   www.milbo.org/postscript/slow-postscript.R

This is not exactly a bug, but is it a known issue?  The hack used to
produce fast.ps above is fragile and not suitable for regular use.  Is there
a option to the postscript() function (or could one be added) that would
sacrifice sRGB support for speed?

Stephen Milborrow
www.milbo.users.sonic.net

Version info:

I'm using GSview 4.9 and Ghostscript 8.64.


R.version

  _
platform   x86_64-pc-mingw32
arch   x86_64
os mingw32
system x86_64, mingw32
status
major  2
minor  13.0
year   2011
month  04
day13
svn rev55427
language   R
version.string R version 2.13.0 (2011-04-13)

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


[Rd] Possible bug in 'relist()' and/or 'as.relistable()'

2011-04-14 Thread Janko Thyson
Dear list,

I think I just stumbled across a bug in either 'relist()' and/or
'as.relistable()'. It seems that 'pairlists' can only be un- and relisted as
long as they're not nested:

Good:
a <- as.relistable(as.pairlist(list(a=1, b=2)))
a <- unlist(a)
relist(a)# Works

Bad:
a <- as.relistable(as.pairlist(list(a=1, b=2, c=list(c.1=1, c.2=2
a <- unlist(a)
relist(a)

The help page didn't say anything about pairlists and I don't know if
they're at all relevant, but I'm using them whenever I want my functions to
recognize a clear 'name-value' structure (e.g. for batch assigning
variables) as opposed to standard list structures.

Cheers,
Janko

> sessionInfo()
R version 2.12.1 (2010-12-16)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=German_Germany.1252  LC_CTYPE=German_Germany.1252   
[3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C   
[5] LC_TIME=German_Germany.1252

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

loaded via a namespace (and not attached):
[1] codetools_0.2-8 tools_2.12.1

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


Re: [Rd] Possible bug in 'relist()' and/or 'as.relistable()'

2011-04-14 Thread Simon Urbanek

On Apr 14, 2011, at 5:13 PM, Janko Thyson wrote:

> Dear list,
> 
> I think I just stumbled across a bug in either 'relist()' and/or
> 'as.relistable()'. It seems that 'pairlists' can only be un- and relisted as
> long as they're not nested:
> 
> Good:
> a <- as.relistable(as.pairlist(list(a=1, b=2)))
> a <- unlist(a)
> relist(a)# Works
> 
> Bad:
> a <- as.relistable(as.pairlist(list(a=1, b=2, c=list(c.1=1, c.2=2

Technically, you're not nesting pairlists - you' are putting a generic vector 
in a parilist ... (not that it matters here).


> a <- unlist(a)
> relist(a)
> 

relist() has no method for pairlists - but you can actually use the "list" 
method as-is:

> relist.pairlist <- utils:::relist.list
> str(src <- as.pairlist(list(a=1, b=2, c=list(c.1=1, c.2=2
Dotted pair list of 3
 $ a: num 1
 $ b: num 2
 $ c:List of 2
  ..$ c.1: num 1
  ..$ c.2: num 2
> str(relist(unlist(as.relistable(src
Dotted pair list of 3
 $ a: num 1
 $ b: num 2
 $ c:List of 2
  ..$ c.1: num 1
  ..$ c.2: num 2
 - attr(*, "class")= chr [1:2] "relistable" "pairlist"

and that will also support actual nested pairlists:

> str(src <- pairlist(a=1, b=2, c=pairlist(c.1=1, c.2=2)))
Dotted pair list of 3
 $ a: num 1
 $ b: num 2
 $ c:Dotted pair list of 2
  ..$ c.1: num 1
  ..$ c.2: num 2
> str(relist(unlist(as.relistable(src
Dotted pair list of 3
 $ a: num 1
 $ b: num 2
 $ c:Dotted pair list of 2
  ..$ c.1: num 1
  ..$ c.2: num 2
 - attr(*, "class")= chr [1:2] "relistable" "pairlist"


so I guess it should be easy to add relist.pairlist to utils ... I'm not sure 
about the implications, but it does sound appealing.

Cheers,
Simon



> The help page didn't say anything about pairlists and I don't know if
> they're at all relevant, but I'm using them whenever I want my functions to
> recognize a clear 'name-value' structure (e.g. for batch assigning
> variables) as opposed to standard list structures.
> 
> Cheers,
> Janko
> 
>>sessionInfo()
> R version 2.12.1 (2010-12-16)
> Platform: i386-pc-mingw32/i386 (32-bit)
> 
> locale:
> [1] LC_COLLATE=German_Germany.1252  LC_CTYPE=German_Germany.1252   
> [3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C   
> [5] LC_TIME=German_Germany.1252
> 
> attached base packages:
> [1] stats graphics  grDevices utils datasets  methods   base 
> 
> loaded via a namespace (and not attached):
> [1] codetools_0.2-8 tools_2.12.1
> 
> __
> 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


[Rd] DESCRIPTION file and Rd examples

2011-04-14 Thread Dario Strbenac
I have a confusing error from R CMD check that I don't get when running the 
example manually by hand.

In the \examples section of an Rd file, I create a GRanges object, then I call 
a function with the GRanges object, whose first 2 lines are

require(GenomicRanges)
annoDF <- as.data.frame(anno) # anno is the GRanges object.

and that second line gives:

Error in as.data.frame.default(anno) : 
  cannot coerce class 'structure("GRanges", package = "GenomicRanges")' into a 
data.frame
Calls: annoGR2DF ... annoGR2DF -> .local -> as.data.frame -> 
as.data.frame.default

I have GenomicRanges listed in my Imports: field, and IRanges in the Suggests: 
of the DESCRIPTION file (it's require()d elsewhere). I'm trying to avoid 
putting packages in Depends: , so my package loads fast. Any tips of what I'm 
not understanding properly ?

Thanks.

--
Dario Strbenac
Research Assistant
Cancer Epigenetics
Garvan Institute of Medical Research
Darlinghurst NSW 2010
Australia

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