Re: [R] how to handle no lines in input with pipe()

From: Jeff Newmiller <jdnewmil_at_dcn.davis.ca.us>
Date: Mon, 04 Apr 2011 21:22:47 -0700

Perhaps use tryCatch...



Jeff Newmiller The ..... ..... Go Live... DCN:<jdnewmil_at_dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing
Research Engineer (Solar/Batteries O.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k

Sent from my phone. Please excuse my brevity.

Andrew Yee <yee_at_post.harvard.edu> wrote:

This has to do with using pipe() and grep and read.csv() I have a .csv file that I grep using pipe() and read.csv() as follows: read.csv(pipe('grep foo bar.csv')) However, is there a way to have this command run when for example, there is no "foo" text in the bar.csv file? I get an error message (appropriately): Error in read.table(file = file, header = header, sep = sep, quote = quote, : no lines available in input Is there a way to "inspect" the output of pipe before passing it on to read.csv()? Thanks, Andrew_____________________________________________
R-help@r-project.org mailing list 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.

        [[alternative HTML version deleted]]



R-help_at_r-project.org mailing list
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. Received on Tue 05 Apr 2011 - 04:28:04 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 05 Apr 2011 - 08:20:27 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive