Hi,
How do you people avoid copy-pasting and manual editing of the code
posted in this list? I mean that if some one post a solution for an
answer like this:
a - 1:10
a
[1] 1 2 3 4 5 6 7 8 9 10
a[1:5]
[1] 1 2 3 4 5
I have to copy-paste it to e.g. Tinn-R and remove part of the
At least in windows, if you right click directly in the r console,
there's a command for 'Paste commands only' which may be one solution...
Not sure about other platforms..
hth
c
johannes rara wrote:
Hi,
How do you people avoid copy-pasting and manual editing of the code
posted in this
On 19-Sep-09 08:00:18, Cedrick W. Johnson wrote:
At least in windows, if you right click directly in the r console,
there's a command for 'Paste commands only' which may be one
solution...
Not sure about other platforms..
hth
c
It was precisely for this kind of reason that, when
The R help mailing list posting guide
http://www.r-project.org/posting-guide.html
suggests to give an example in this form
...snip...
f I have a matrix x as follows:
x - matrix(1:8, nrow=4, ncol=2,
dimnames=list(c(A,B,C,D), c(x,y))
x
x y
A 1 5
B 2 6
C 3 7
D 4 8
On 19-Sep-09 08:48:45, johannes rara wrote:
The R help mailing list posting guide
http://www.r-project.org/posting-guide.html
suggests to give an example in this form
...snip...
f I have a matrix x as follows:
x - matrix(1:8, nrow=4, ncol=2,
it might be possible to set up a particular mode before copying the history,
### start example ###
email = function(op){
if(!missing(op)) {
options(op) } else {
op - options()
options(prompt = )
options(continue = )
op
}
}
op = email()
a = 1:10
a
email(op)
a = 1:10
a
### end
One solution would be to have a portable version of the
Windows
Edit | Paste commands only
functionality that works on all platforms.
For example if a command such as this were available:
source.commands - function(echo = TRUE, ...) {
L - readLines(clipboard)
L - grep(^[+] , L,
On 19-Sep-09 14:12:08, Gabor Grothendieck wrote:
One solution would be to have a portable version of the
Windows
Edit | Paste commands only
functionality that works on all platforms.
For example if a command such as this were available:
source.commands - function(echo = TRUE, ...)
On 19/09/2009 10:12 AM, Gabor Grothendieck wrote:
One solution would be to have a portable version of the
Windows
Edit | Paste commands only
functionality that works on all platforms.
For example if a command such as this were available:
source.commands - function(echo = TRUE, ...) {
On Sep 19, 2009, at 10:58 AM, Duncan Murdoch wrote:
On 19/09/2009 10:12 AM, Gabor Grothendieck wrote:
One solution would be to have a portable version of the
Windows
Edit | Paste commands only
functionality that works on all platforms.
For example if a command such as this were available:
Thanks for the responses.
I think that the best way to avoid lots of hassle is that people
copy-paste their solutions from their code editor, NOT from R console.
For example, I usually save those solutions for my code archive, and
if I want to run these later on (using Tinn-R), I have to parse
On Sep 19, 2009, at 11:58 AM, johannes rara wrote:
Thanks for the responses.
I think that the best way to avoid lots of hassle is that people
copy-paste their solutions from their code editor, NOT from R console.
For example, I usually save those solutions for my code archive, and
if I want
Combining the code posted by myself, Duncan and David we have:
# Usage: copy code from r-help to clipboard, then in R enter this:
# source.commands()
#
source.commands - function(echo = TRUE, max.deparse.length = Inf, ...) {
# L - readLines(pipe(pbpaste)) # use this instead for Mac
L -
Neat!
What if, instead, one wanted to format his/her code in the console
before sending it by email? Any tips for that?
(I proposed something like options(prompt= ) above, but got stuck
with adding a comment # to printed results)
Thanks,
baptiste
2009/9/19 Gabor Grothendieck
I made a python script to parse and + marks, if someone is interested:
#- start --
#!/Python26/
# -*- coding: utf-8 -*-
import sys
def main(argv):
if len(argv) 2:
sys.stderr.write(Usage: %s file.txt % (argv[0],))
return 1
f =
OK. I've combined both approaches into a single process.source()
function. Just place the mixed R code and output in the clipboard
and run:
source.commands()
it will 1. first display clipboard in a suitable manner for pasting into
an r-help post and then 2. execute it.
Thus you can either
16 matches
Mail list logo