[Rd] Ellipsis to Two Functions When One Has Nested Functions

2014-05-27 Thread Dario Strbenac
Hello

If I have a function

aFunction <- function(data, alpha, ...)
{
transform(alpha, ...)
rowMeans(data) > alpha
}

f <- function(data, selection, ...)
{
selected <- selection(data, ...)
plot(data[selected, ], ...)
}

f(aDataset, aFunction, alpha = 10, pch = 19, transform = sqrt)

and selection calls another function, which has ... and that function calls 
other functions, is there an easier way than getting the formals of all the 
functions called internally by selection, and all of the formals of functions 
called by plot ? Is there any option to change the error into a warning message 
?

--
Dario Strbenac
PhD Student
University of Sydney
Camperdown NSW 2050
Australia

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


Re: [Rd] Pretty-printer for R data

2014-05-27 Thread Greg Snow
There are editors that are R aware and have some functionality along
these lines (though I don't know of any command line type).  Some to
look at are the Emacs/ESS combination or Rstudio.

On Tue, May 27, 2014 at 11:10 AM, Stavros Macrakis (Σταῦρος Μακράκης)
 wrote:
> Is there a pretty-printer for R data (and code for that matter), similar to
> Lisp's prettyprint/grind? I've looked in CRAN, and couldn't find anything.
>
> For example, I'd like to have:
>
> prettyprint(list(a=1:20*2, b=list(data.frame(q = c(2,1,3),
>   r = c(3,1,2), s = c(1,3,2)), as.POSIXct("2014-02-03")))
>
> *  =>*
>
> list(a = c(2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22,
>24, 26, 28, 30, 32, 34, 36, 38, 40),
>  b = list(data.frame(q = c(2, 1, 3),
>  r = c(3, 1, 2),
>  s = c(1, 3, 2))
>   as.POSIXct("2014-02-03")))
>
> That is, something like dput, but with operators, structural indentation,
> and line breaks chosen intelligently. (Whether to use as.POSIXct or
> structure(...) etc. presumably could be under control of parameters.)
>
>  -s
>
> [[alternative HTML version deleted]]
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



-- 
Gregory (Greg) L. Snow Ph.D.
538...@gmail.com

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


[Rd] Pretty-printer for R data

2014-05-27 Thread Σταῦρος Μακράκης
Is there a pretty-printer for R data (and code for that matter), similar to
Lisp's prettyprint/grind? I've looked in CRAN, and couldn't find anything.

For example, I'd like to have:

prettyprint(list(a=1:20*2, b=list(data.frame(q = c(2,1,3),
  r = c(3,1,2), s = c(1,3,2)), as.POSIXct("2014-02-03")))

*  =>*

list(a = c(2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22,
   24, 26, 28, 30, 32, 34, 36, 38, 40),
 b = list(data.frame(q = c(2, 1, 3),
 r = c(3, 1, 2),
 s = c(1, 3, 2))
  as.POSIXct("2014-02-03")))

That is, something like dput, but with operators, structural indentation,
and line breaks chosen intelligently. (Whether to use as.POSIXct or
structure(...) etc. presumably could be under control of parameters.)

 -s

[[alternative HTML version deleted]]

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


Re: [Rd] dput line width

2014-05-27 Thread Greg Snow
Looking at the help file and code for dput does not show any simple
way to do what you want.  But the help page makes reference to the
deparse function and deparse does have a width.cutoff argument.  So
you could use deparse instead of dput (the use cat or other functions
to display the results similar to dput).  A quick example (though
going the opposite direction):

> cat(deparse(1:30*2, width.cutoff=20),'\n\n',sep='\n')
c(2, 4, 6, 8, 10, 12,
14, 16, 18, 20, 22, 24,
26, 28, 30, 32, 34, 36,
38, 40, 42, 44, 46, 48,
50, 52, 54, 56, 58, 60
)



On Tue, May 27, 2014 at 9:15 AM, Stavros Macrakis (Σταῦρος Μακράκης)
 wrote:
> Is there some way to control the line width that dput uses?
> options(width=...) does not affect dput.
>
> For example, currently
>
>> dput(1:30*2)
> c(2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, *line break
> here*
> 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60)
>
> but on a wider display, I'd like to have no line break.
>
>
> Tested on R version 3.1.0 (2014-04-10) x86_64-apple-darwin13.1.0 (64-bit)
>
> [[alternative HTML version deleted]]
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



-- 
Gregory (Greg) L. Snow Ph.D.
538...@gmail.com

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


[Rd] dput line width

2014-05-27 Thread Σταῦρος Μακράκης
Is there some way to control the line width that dput uses?
options(width=...) does not affect dput.

For example, currently

> dput(1:30*2)
c(2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, *line break
here*
34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60)

but on a wider display, I'd like to have no line break.


Tested on R version 3.1.0 (2014-04-10) x86_64-apple-darwin13.1.0 (64-bit)

[[alternative HTML version deleted]]

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