Re: [R] httr::content without message

2018-01-02 Thread Ben Tupper
That's good to know about when to auto-parse and when not to. There is quite a big stable of tools to check the response before you try to read... > httr::http_error(r1) [1] FALSE > httr::http_status(r1) $category [1] "Success" $reason [1] "OK" $message [1] "Success: (200) OK" and > httr::h

Re: [R] httr::content without message

2018-01-02 Thread Roy Mendelssohn - NOAA Federal
Thanks to all that replied. I had just looked through the httr code and sure enough for a .csv mime time it calls readr::read_csv(). The httr::content docs suggest not using automatic parsing in a package, rather to determine mime type and parse yourself and Ben's suggestion also works if I d

Re: [R] httr::content without message

2018-01-02 Thread William Dunlap via R-help
You can suppress all messages from that command with junk <- suppressMessages(httr::content(r1)) If you only want to suppress that specific message you can use withCallingHandlers: junk <- withCallingHandlers( httr::content(r1), message=function(e){ if (grepl("P

Re: [R] httr::content without message

2018-01-02 Thread Ben Tupper
Ahoy! That's a message generated by the readr::read_table() function (or it's friends). You can suppress it a number of ways, but this should work as httr::content() will pass through arguments, like col_types = cols(), to the file reader. junk <- httr::content(r1, col_types = cols()) See mo

Re: [R] httr::content without message

2018-01-02 Thread David Winsemius
> On Jan 2, 2018, at 9:30 AM, Roy Mendelssohn - NOAA Federal > wrote: > > Hi All: > > I am using httr to download files form a service, in this case a .csv file. > When I use httr::content on the result, I get a message. Since this will be > in a package. I want to suppress the message,

[R] httr::content without message

2018-01-02 Thread Roy Mendelssohn - NOAA Federal
Hi All: I am using httr to download files form a service, in this case a .csv file. When I use httr::content on the result, I get a message. Since this will be in a package. I want to suppress the message, but haven't figured out how to do so. The following should reproduce the result: m