Re: [R] sub question

2009-02-03 Thread Wacek Kusnierczyk
Gabor Grothendieck wrote: This comes from the all.vars function and would indicate a bug in that base R function. hush! a user bug, i presume? but indeed, all.vars(expression(foo(bar)())) # character(0) all.names(expression(foo(bar)())) # foo bar vQ f = function(a) function()

Re: [R] sub question

2009-02-03 Thread Wacek Kusnierczyk
Peter Dalgaard wrote: Wacek Kusnierczyk wrote: Gabor Grothendieck wrote: This comes from the all.vars function and would indicate a bug in that base R function. hush! a user bug, i presume? but indeed, all.vars(expression(foo(bar)())) # character(0)

Re: [R] sub question

2009-02-03 Thread Peter Dalgaard
Wacek Kusnierczyk wrote: (a) do not descend recursively into the function part (first element) of a call (b) do descend, unless it is a name if it is a name, how would you descend? By calling a recursive function which has it as the argument. It's not a problem unless you want it to be

Re: [R] sub question

2009-02-03 Thread Peter Dalgaard
Wacek Kusnierczyk wrote: Gabor Grothendieck wrote: This comes from the all.vars function and would indicate a bug in that base R function. hush! a user bug, i presume? but indeed, all.vars(expression(foo(bar)())) # character(0) all.names(expression(foo(bar)())) # foo bar Semantic

Re: [R] sub question

2009-02-03 Thread Wacek Kusnierczyk
Peter Dalgaard wrote: Gabor Grothendieck wrote: On Sat, Jan 31, 2009 at 6:01 PM, Wacek Kusnierczyk th some additional boring pedantry wrt. ?gsubfn, which says: If 'replacement' is a formula instead of a function then a one line function is created whose body is the right hand side of

Re: [R] sub question

2009-02-03 Thread Gabor Grothendieck
This comes from the all.vars function and would indicate a bug in that base R function. f = function(a) function() paste(a, a, sep=) all.vars(~ fo(o)()) character(0) On Tue, Feb 3, 2009 at 8:24 AM, Wacek Kusnierczyk waclaw.marcin.kusnierc...@idi.ntnu.no wrote: Peter Dalgaard wrote: Gabor

Re: [R] sub question

2009-02-03 Thread Peter Dalgaard
Wacek Kusnierczyk wrote: But can you be sure that there is no legitimate reason for expecting the current behaviour? you surely know the answer. Actually, I don't. I was just pointing out the generic risk of fixing something that isn't broken by breaking something that works. There's a

Re: [R] sub question

2009-02-03 Thread Wacek Kusnierczyk
Peter Dalgaard wrote: Wacek Kusnierczyk wrote: (a) do not descend recursively into the function part (first element) of a call (b) do descend, unless it is a name if it is a name, how would you descend? By calling a recursive function which has it as the argument. It's not a problem

Re: [R] sub question

2009-02-01 Thread Peter Dalgaard
Gabor Grothendieck wrote: On Sat, Jan 31, 2009 at 6:01 PM, Wacek Kusnierczyk th some additional boring pedantry wrt. ?gsubfn, which says: If 'replacement' is a formula instead of a function then a one line function is created whose body is the right hand side of the formula and whose

Re: [R] sub question

2009-02-01 Thread Gabor Grothendieck
On Sun, Feb 1, 2009 at 6:44 AM, Peter Dalgaard p.dalga...@biostat.ku.dk wrote: Gabor Grothendieck wrote: On Sat, Jan 31, 2009 at 6:01 PM, Wacek Kusnierczyk th some additional boring pedantry wrt. ?gsubfn, which says: If 'replacement' is a formula instead of a function then a one line

Re: [R] sub question

2009-02-01 Thread Wacek Kusnierczyk
Peter Dalgaard wrote: Gabor Grothendieck wrote: On Sat, Jan 31, 2009 at 6:01 PM, Wacek Kusnierczyk th some additional boring pedantry wrt. ?gsubfn, which says: If 'replacement' is a formula instead of a function then a one line function is created whose body is the right hand side of

Re: [R] sub question

2009-02-01 Thread Wacek Kusnierczyk
Wacek Kusnierczyk wrote: Gabor Grothendieck wrote: On Sat, Jan 31, 2009 at 4:46 PM, Wacek Kusnierczyk waclaw.marcin.kusnierc...@idi.ntnu.no wrote: to extend the context, if you were to solve the problem in perl, the regex below would work in perl 5.10, but not in earlier

Re: [R] sub question

2009-01-31 Thread David Hajage
Thank you, it's perfect. david 2009/1/30 Wacek Kusnierczyk waclaw.marcin.kusnierc...@idi.ntnu.no David Hajage wrote: Hello R users, I have a string, for example: x - \t\tabc\t def This string can contain any number of tabulations. I want to replace each tabulation of the begining

Re: [R] sub question

2009-01-31 Thread Wacek Kusnierczyk
David Hajage wrote: Thank you, it's perfect. to extend the context, if you were to solve the problem in perl, the regex below would work in perl 5.10, but not in earlier versions of perl; another approach is to replace the unwanted leading characters with equally many replacement characters

Re: [R] sub question

2009-01-31 Thread Gabor Grothendieck
On Sat, Jan 31, 2009 at 4:46 PM, Wacek Kusnierczyk waclaw.marcin.kusnierc...@idi.ntnu.no wrote: David Hajage wrote: Thank you, it's perfect. to extend the context, if you were to solve the problem in perl, the regex below would work in perl 5.10, but not in earlier versions of perl;

Re: [R] sub question

2009-01-31 Thread Wacek Kusnierczyk
Gabor Grothendieck wrote: On Sat, Jan 31, 2009 at 4:46 PM, Wacek Kusnierczyk waclaw.marcin.kusnierc...@idi.ntnu.no wrote: David Hajage wrote: Thank you, it's perfect. to extend the context, if you were to solve the problem in perl, the regex below would work in perl 5.10,

Re: [R] sub question

2009-01-31 Thread Gabor Grothendieck
On Sat, Jan 31, 2009 at 6:01 PM, Wacek Kusnierczyk waclaw.marcin.kusnierc...@idi.ntnu.no wrote: Gabor Grothendieck wrote: On Sat, Jan 31, 2009 at 4:46 PM, Wacek Kusnierczyk waclaw.marcin.kusnierc...@idi.ntnu.no wrote: David Hajage wrote: Thank you, it's perfect. to extend the context, if

[R] sub question

2009-01-30 Thread David Hajage
Hello R users, I have a string, for example: x - \t\tabc\t def This string can contain any number of tabulations. I want to replace each tabulation of the begining of the string by the same number of space: abc\t def I'm trying to do this with gsub : gsub(\t, , x) # replace every \t [1]

Re: [R] sub question

2009-01-30 Thread Wacek Kusnierczyk
David Hajage wrote: Hello R users, I have a string, for example: x - \t\tabc\t def This string can contain any number of tabulations. I want to replace each tabulation of the begining of the string by the same number of space: abc\t def I'm trying to do this with gsub : gsub(\t,