I'd like to be able to access the windows clipboard from R under Cygwin. But...> read.table(file="clipboard")Error in file(file, "rt") : cannot open the connection In addition: Warning message: In file(file, "rt") : unable to contact X11 display>Is this supported in any way? Thanks -Ed
On Tue, 21 May 2019 09:55:21 -0500 Ed Siefker <ebs15242 at gmail.com> wrote:> I'd like to be able to access the windows clipboard from R under > Cygwin.Searching for "cygwin windows clipboard" offers reading from and writing to /dev/clipboard as a file and getclip.exe / putclip.exe from cygutils-extra package[*] which you could use in a pipe(). -- Best regards, Ivan [*] https://cygwin.com/cgi-bin2/package-cat.cgi?file=x86_64%2Fcygutils-extra%2Fcygutils-extra-1.4.16-2&grep=cygutils-extra
I think the "clipboard" filename is handled in the Windows build of R. I don't use the cygwin build of R, so I can't test, but Googling "cygwin clipboard" finds references to "/dev/clipboard" implemented by cygwin independent from R. I can't let the opportunity pass to strongly recommend avoiding work processes that route data through the clipboard... it is an anti-pattern for reproducibility... and reproducibility leads to incremental process improvement and more defensible results. On May 21, 2019 7:55:21 AM PDT, Ed Siefker <ebs15242 at gmail.com> wrote:>I'd like to be able to access the windows clipboard from R under >Cygwin. >But... > >> read.table(file="clipboard") >Error in file(file, "rt") : cannot open the connection >In addition: Warning message: >In file(file, "rt") : unable to contact X11 display >> > >Is this supported in any way? Thanks >-Ed > >______________________________________________ >R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide >http://www.R-project.org/posting-guide.html >and provide commented, minimal, self-contained, reproducible code.-- Sent from my phone. Please excuse my brevity.
On 21/05/2019 10:55 a.m., Ed Siefker wrote:> I'd like to be able to access the windows clipboard from R under Cygwin. > But... > >> read.table(file="clipboard") > Error in file(file, "rt") : cannot open the connection > In addition: Warning message: > In file(file, "rt") : unable to contact X11 display >> > > Is this supported in any way? ThanksCygwin is not supported in any way by the R project, as far as I know. There's a native Windows build that is supported, and I'd strongly recommend you use it instead. Duncan Murdoch
What Duncan says, but in case you are feeling adventurous or have strong reasons to be in the Cygwin parallel universe, notice that the error indicates that R is loooking for an X11 display. So, at a minimum, you need to have (a) an X11 display server running (b) R setup so that it knows how to find X11 (usually via the DISPLAY env. variable) Even so, you still risk finding that the X11 clipboard does not integrate with the Windows clipboard, so al bets are off. - pd> On 22 May 2019, at 00:54 , Duncan Murdoch <murdoch.duncan at gmail.com> wrote: > > On 21/05/2019 10:55 a.m., Ed Siefker wrote: >> I'd like to be able to access the windows clipboard from R under Cygwin. >> But... >>> read.table(file="clipboard") >> Error in file(file, "rt") : cannot open the connection >> In addition: Warning message: >> In file(file, "rt") : unable to contact X11 display >>> >> Is this supported in any way? Thanks > > Cygwin is not supported in any way by the R project, as far as I know. There's a native Windows build that is supported, and I'd strongly recommend you use it instead. > > Duncan Murdoch > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.-- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com
> I'd like to be able to access the windows clipboard from R under Cygwin. > Is this supported in any way? ThanksHi Ed You can access the Windows clipboard under Cygwin. I ran R within Cygwin. I was able to use read.table (file="clipboard") for both plain text and Excel tables.> #table copied from excel > tbl = read.table (file="clipboard", TRUE) > tblA B C D 1 1 5 9 13 2 2 6 10 14 3 3 7 11 15 4 4 8 12 16 Note that when copying plain text you may need to include a final newline character. The X11() message is suspicious. I'm wondering what type of object you're trying to copy...? Abs [[alternative HTML version deleted]]
On 22/05/2019 8:57 p.m., Abby Spurdle wrote:> > I'd like to be able to access the windows clipboard from R under Cygwin. > > Is this supported in any way?? Thanks > > Hi Ed > > You can access the Windows clipboard under Cygwin. > I ran R within Cygwin. > I was able to use read.table (file="clipboard") for both plain text and > Excel tables. > > > #table copied from excel > > tbl = read.table (file="clipboard", TRUE) > > tbl > ? A B ?C ?D > 1 1 5 ?9 13 > 2 2 6 10 14 > 3 3 7 11 15 > 4 4 8 12 16 > > Note that when copying plain text you may need to include a final > newline character. > > The X11() message is suspicious. > I'm wondering what type of object you're trying to copy...?I think Ed was running the Cygwin build of R. Cygwin can run the Windows build of R, and it sounds as though that's what you did (and what Ed should do.) Duncan Murdoch