Re: [Rd] patch for 'merge' docs

2009-03-08 Thread Kasper Daniel Hansen

Roger

(I think) L is shorthand for some logical value, ie. TRUE or FALSE.  
That has always been pretty clear to me. Your patch was stripped.


Kasper

On Mar 8, 2009, at 18:20 , Roger D. Peng wrote:


I've never quite understood the documentation for the 'all' argument
to 'merge'. I'm pretty sure using 'all = L' doesn't work but I'm open
to correction here. In any event, I've attached a patch.

-roger

--
Roger D. Peng  |  http://www.biostat.jhsph.edu/~rpeng/
__
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] patch for 'merge' docs

2009-03-08 Thread Roger D. Peng
I've never quite understood the documentation for the 'all' argument
to 'merge'. I'm pretty sure using 'all = L' doesn't work but I'm open
to correction here. In any event, I've attached a patch.

-roger

-- 
Roger D. Peng  |  http://www.biostat.jhsph.edu/~rpeng/
__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] [RFC] running octave, python from within R

2009-03-08 Thread Soeren Sonnenburg
Dear all,

a Shogun 0.7.1 is out and available at http://www.shogun-toolbox.org

which contains one new feature that might be of interest to
R users. The eierlegendewollmilchsau interface. In
case you don't know what this term stands for use google images :-)

It is one file that will interface shogun to octave,r,python,matlab. It
provides commands to run code in foreign languages:

Example:

library(elwms)

A=matrix(c(1.0,2,3, 4,5,6), nrow = 2, ncol=3)
B=matrix(c(1.0,1,1, 0,0,0), nrow = 2, ncol=3)
pythoncode=sprintf('import numpy\nresults=tuple([A+B])');
elwms('run_python', 'pythoncode', 'print "hi"')
C=elwms('run_python', 'A',A, 'B',B, 'pythoncode', pythoncode)
D=elwms('run_python', 'A',A+1, 'B',B*2, 'pythoncode', pythoncode)
pythoncode=sprintf('import numpy\nresults=(A, B, [ "bla1",
"bla2" ])\n');
X=elwms('run_python', 'A',A, 'B',B, 'pythoncode', pythoncode)
print(A)
print(B)
print(C)
print(D)
print(X)


This would pass around matrices A and B do some processing and return
results. So you could use your old octave/matlab scriptspassing around
strings cells, or whatever matrices/stringsor plot some nice figures via
matplotlib in python

See http://www.shogun-toolbox.org/doc/elwmsinterface.html .
Don't even try to run octave from python from octave etc nested.
Neither octave, R nor python-numpy nor libshogun supports this :-)

Soeren

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


Re: [Rd] Follow-up on the wish for a visibility flag with tryEval ?

2009-03-08 Thread Laurent Gautier
I guess that I should have been reminding that the thread referred to is 
mostly about C API-level utilities (and the subject for this thread 
should be mentioning more precisely *R_tryEval()* ).


Wrapping evaluation from C-level in an R-level withVisible() call is 
certainly possible if this is the only way to do it:


- a C-level utility function is probably becoming handy (and that's 
mostly what the wish is about, AFAIUI).


- the traceback has at least one added layer from the call to 
withVisible(); this is something supplementary to take care of when 
writing a GUI for example.


Those are possible reasons why the threads tells that withVisible() 
[R-level] is a temporary option, waiting for something like 
R_tryEvalWithVis() [C-level].



Can't I find any such C-level because there isn't any, or because I just 
missed it ?




Thanks,





L.




Duncan Murdoch wrote:

On 07/03/2009 9:51 AM, Laurent Gautier wrote:

Dear list,

Did the wish for an official API for evaluating expressions while 
keeping an eye on the R_Visible flag (see:

https://stat.ethz.ch/pipermail/r-devel/2007-April/045258.html
) lead to something ?

I could not find a sign of it the current (R-2.8.1 and R-2.9-dev) R 
defines.


You should read the NEWS file, where you'll find withVisible mentioned.

Duncan Murdoch


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


Re: [Rd] question

2009-03-08 Thread Wacek Kusnierczyk
ivo...@gmail.com wrote:
> Gentlemen---these are all very clever workarounds, but please forgive me  
> for voicing my own opinion: IMHO, returning multiple values in a  
> statistical language should really be part of the language itself. there  
> should be a standard syntax of some sort, whatever it may be, that everyone  
> should be able to use and which easily transfers from one local computer to  
> another. It should not rely on clever hacks in the .Rprofile that are  
> different from user to user, and which leave a reader of end user R code  
> baffled at first by all the magic that is going on. Even the R tutorials  
> for beginners should show a multiple-value return example right at the  
> point where function calls and return values are first explained.
>
>   

hi again,

i was playing a bit with the idea of multiple assignment, and came up
with a simple codebit [1] that redefines the operator '='.  it hasn't
been extensively tested and is by no means foolproof, but allows various
sorts of tricks with multiple assignments:

source('http://miscell.googlecode.com/svn/rvalues/rvalues.r',
local=TRUE)

a = function(n) 1:n
# a is a function

b = a(3)
# b is c(1, 2, 3)

c(c, d) = a(1)
# c is 1, d is NULL

c(a, b) = list(b, a)
# swap: a is 1:3, b is a function

# these are equivalent:
c(a, b) = 1:2
{a; b} = 1:2
list(a, b) = 1:2

a = data.frame(x=1:3, y=3)
# a is a 2-column data frame

c(a, b) = data.frame(x=1:3, b=3)
# a is c(1, 2, 3), b is c(3, 3, 3)

and so on.  this is sort of pattern matching as in some functional
languages, but only sort of:  it does not do recursive matching, for
example:

c(c(a, b), c) = list(1:2, 3)
# error
# not: a = 1, b = 2, c = 3
 
anyway, it's just a toy for which there is no need.

vQ


[1] svn checkout */http/*://miscell.googlecode.com/svn/rvalues

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