[R] How to loop over two files ...

Ivan Krylov kry|ov@r00t @end|ng |rom gm@||@com
Sat Jun 20 10:47:53 CEST 2020


On Fri, 19 Jun 2020 19:36:41 -0500
Ana Marija <sokovic.anamarija using gmail.com> wrote:

> Error in cat(x, file = file, sep = c(rep.int(sep, ncolumns - 1),
> "\n"),  : argument 1 (type 'list') cannot be handled by 'cat'

It might be a good idea to try to solve problems like this yourself
instead of waiting for hours for someone to reply. All the required
information is there in the error message: write() fails because r is a
list. Why is r a list? It's returned from GET(), so let's read its
documentation.

httr::GET() returns a response object, not a string [1]. Try passing
as.character(r) or content(r,'text') instead of just r to write(...) or
use a different way of extracting the actual response from the response
object.

-- 
Best regards,
Ivan

[1] https://httr.r-lib.org/reference/GET.html



More information about the R-help mailing list