Re: [R] File > Save As...

2011-04-13 Thread Gene Leynes
as of right now x = function(a) print(a) attr(x, "srcref") returns NULL in 2.13, am I doing something wrong? (also, should I post this to a new thread, or the development thread?) About me: I like long walks on the beach, and this is my current version of R: > t(as.data.frame(R.Version())

Re: [R] File > Save As...

2011-04-13 Thread Gene Leynes
That's very interesting. It's not what I was thinking about or expecting, but I'm glad to know about it (and it will probably be useful at some point). Initially, I was asking for a method to find out the name of the current script. I mean, the current script that you're editing / running. Howe

Re: [R] File > Save As...

2011-04-13 Thread Duncan Murdoch
On 13/04/2011 5:20 PM, Gene Leynes wrote: as of right now x = function(a) print(a) attr(x, "srcref") returns NULL in 2.13, am I doing something wrong? There's a limitation to the debug information: it can't be attached to a function whose body consists of a single simple expression

Re: [R] File > Save As...

2011-03-16 Thread Gene Leynes
Thanks for showing me the link to the code / your response / your work in general. It seems that the real magic is happening in the call to the function attributes, via the line attr(x, "srcref") I'm guessing that attributes must be defined somewhere deep inside the R machinery (since I didn't fin

Re: [R] File > Save As...

2011-03-16 Thread Hadley Wickham
> No, defaults are evaluated in the evaluation frame of the function. That's > why you can use local variables in them, e.g. the way rgamma uses 1/rate as > a default for scale. Oops, yes, I was getting confused with promises - non-missing arguments are promises evaluated in the parent frame. > B

Re: [R] File > Save As...

2011-03-15 Thread Duncan Murdoch
On 11-03-15 9:10 PM, Hadley Wickham wrote: Could getSrcFilename() gain a default argument so that getSrcFilename() would by default return the path of the executing script? No, it needs to see a function defined in that script. But I thought default arguments were evaluated in the parent envi

Re: [R] File > Save As...

2011-03-15 Thread Hadley Wickham
>> Could getSrcFilename() gain a default argument so that >> getSrcFilename() would by default return the path of the executing >> script? > > No, it needs to see a function defined in that script. But I thought default arguments were evaluated in the parent environment? Does that not follow for

Re: [R] File > Save As...

2011-03-15 Thread Gene Leynes
The "getSrcFilename" function is exactly what I was trying to describe, and I'm excited to know that it's on it way! I have tried to create that type of function, but I didn't think it was possible with currently available functions. I would be interested in seeing how the new function works, may

Re: [R] File > Save As...

2011-03-15 Thread Duncan Murdoch
On 15/03/2011 4:45 PM, Hadley Wickham wrote: The bigger issue is that R can't tell the location of an open script, which makes it harder to create new versions of existing work But it can. If you open a script and choose save, it will be saved to the same place. Or do you mean an executin

Re: [R] File > Save As...

2011-03-15 Thread Hadley Wickham
>> The bigger issue is that R can't tell the location of an open script, >> which makes it harder to create new versions of existing work > > But it can.  If you open a script and choose save, it will be saved to the > same place.  Or do you mean an executing script?  There are indirect ways to

Re: [R] File > Save As...

2011-03-15 Thread Duncan Murdoch
On 15/03/2011 2:56 PM, Gene Leynes wrote: The "getSrcFilename" function is exactly what I was trying to describe, and I'm excited to know that it's on it way! I have tried to create that type of function, but I didn't think it was possible with currently available functions. I would be interest

Re: [R] File > Save As...

2011-03-14 Thread Duncan Murdoch
On 11-03-14 8:12 PM, Gene Leynes wrote: Yes, I understand. Normally I use Eclipse, which does what I want for "save as..." The bigger issue is that R can't tell the location of an open script, which makes it harder to create new versions of existing work But it can. If you open a script

Re: [R] File > Save As...

2011-03-14 Thread Jeff Newmiller
My preferred cycle with RGui is: 1) Open RGui 2) Save (empty) workspace in the new working directory 3) Quit RGui 4) Double-click on the saved workspace. This opens RGui and sets the working directory. 5) Open Notepad++ and edit as desired 6) Select code to run 7) Press F8 I have also been playi

Re: [R] File > Save As...

2011-03-14 Thread Gene Leynes
Yes, I understand. Normally I use Eclipse, which does what I want for "save as..." The bigger issue is that R can't tell the location of an open script, which makes it harder to create new versions of existing work Say you have some great analysis going in "Research 2011-01-01" with a folder

Re: [R] File > Save As...

2011-03-14 Thread Duncan Murdoch
On 11-03-14 5:03 PM, Gene Leynes wrote: As much as I love R, there are still the occasional shortcomings. I would love to find a solution to the "save as..." problem. Steps to reproduce the problem: 1. Open any version of he R GUI in Windows 2. Choose "File> Open" from the menu 3.

[R] File > Save As...

2011-03-14 Thread Gene Leynes
As much as I love R, there are still the occasional shortcomings. I would love to find a solution to the "save as..." problem. Steps to reproduce the problem: 1. Open any version of he R GUI in Windows 2. Choose "File > Open" from the menu 3. Open a script that is in a different directo