Skip to content

How to avoid copy-paste when copying code from this list

1 message · David Winsemius

#
This material from Duncan Murdoch may be useful to Mac users:
On Sep 19, 2009, at 10:58 AM, Duncan Murdoch wrote:

            
On Macs (and possibly other *NIXen) the equivalent to reading from the  
"clipboard" is: pipe("pbpaste")

Testing shows that a simple modification after defining  
CleanTranscript produces no error on the example above:

 > source(textConnection(CleanTranscript(readLines(pipe("pbpaste")))),
+        echo = TRUE, max.deparse.length=Inf)

 > example(mean)

mean> x <- c(0:10, 50)

mean> xm <- mean(x)

mean> c(xm, mean(x, trim = 0.10))
[1] 8.75 5.50

mean> mean(USArrests, trim = 0.2)
  Murder  Assault UrbanPop     Rape
    7.42   167.60    66.20    20.16

 > x <- c(0:10, 50)