how to retrieve data from API in R

hi there,

how can retrieve data in R using API?


It probably depends on the API and how that is set up.

The API returns the data in json format.
from get method
what code should i write in R

start here,

hi nirgrahmuk,

res <- curl_fetch_memory("")
myjsondata <- jsonlite::prettify(rawToChar(req$content))
json_data_frame1 <-

I am getting this erro

Error in :
cannot coerce class ‘"json"’ to a data.frame

res <- curl_fetch_memory("")
(myjsondata <- jsonlite::prettify(rawToChar(res$content)))
(myjsondata_df <- jsonlite::fromJSON(myjsondata) %>%
1 Like

hi nirgrahmuk,

thank you very much.
i am making mistake on "" only this line?

can you please tell me what is the meaning of this?

does it mean to casting, as we do in oop programming?
var a = (String) someclass.methodname(objectofanyclass)

does it mean same?

thank you
rao is a base method it only has methods for transforming certain types of things to dayaframes, and a JSON is not one of them. Therefore the jsonlite package itself provides an alternative

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.