[R] Dynamic regex/sub changes to function

2014-09-22 Thread Daniel Fuka
Howdy, I have searched the lists and can not seem to find a solution to my problem. I need to be able to dynamically modify a string inside a function to build a new function. sub replaces with a quoted string... and parse of sub returns expression... How can I get an unquoted string from a regex

Re: [R] Dynamic regex/sub changes to function

2014-09-22 Thread Duncan Murdoch
On 22/09/2014 9:16 AM, Daniel Fuka wrote: Howdy, I have searched the lists and can not seem to find a solution to my problem. I need to be able to dynamically modify a string inside a function to build a new function. sub replaces with a quoted string... and parse of sub returns expression...

Re: [R] Dynamic regex/sub changes to function

2014-09-22 Thread Daniel Fuka
Howdy Duncan, Thanks for the quick reply! I must be missing something simple/obvious. I need to have the sub() not return quoted and escaped characters to just edit the language expression. In my problem, there is a function that is supported from a different package. So I always want to use the

Re: [R] Dynamic regex/sub changes to function

2014-09-22 Thread William Dunlap
If you really want to continue to use the function in the supported package, then you could try asking the maintainer of the package to make the problematic URL an argument to the function. I thnk that changing the function on the fly, no matter how you do it, is likely to cause problems when the

Re: [R] Dynamic regex/sub changes to function

2014-09-22 Thread Daniel Fuka
Unfortunately in this specific case the owner/maintainer is a complete idiot and a major jerk... he is.. well.. me in this case. But, this is something I have also been wanting to figure out for some time as it is often the case when a quick and simple regex based patch to a function can be

Re: [R] Dynamic regex/sub changes to function

2014-09-22 Thread Duncan Murdoch
On 22/09/2014 11:34 AM, Daniel Fuka wrote: Howdy Duncan, Thanks for the quick reply! I must be missing something simple/obvious. I need to have the sub() not return quoted and escaped characters to just edit the language expression. In my problem, there is a function that is supported from a

Re: [R] Dynamic regex/sub changes to function

2014-09-22 Thread Daniel Fuka
Thanks everyone for the help. I need to step back and refresh my memory on expressions as I am still unclear as to why I can not directly edit: body(nsong)[[2]] # Which can be located from a grep: body(nsong)[[grep(fuka,body(nsong))]] # though I believe class(body(nsong)[[2]]) [1] = # is trying to

Re: [R] Dynamic regex/sub changes to function

2014-09-22 Thread Duncan Murdoch
On 22/09/2014, 7:38 PM, Daniel Fuka wrote: Thanks everyone for the help. I need to step back and refresh my memory on expressions as I am still unclear as to why I can not directly edit: body(nsong)[[2]] # Which can be located from a grep: body(nsong)[[grep(fuka,body(nsong))]] # though I