Translate curl into R program

+1 vote

I have the following code

library(RCurl)
library(RJSONIO)
httpPOST("https://api.ibm.com/watsonanalytics/run/data/v1/datasets",
     content= c("description"="Test1",
                          "name"="Test1"),
     .opts = list(httpheader = c('Content-Type' = 'application/json', 
                                 'Accept' = 'application/json',
                                 'X-IBM-Client-Secret' = '123', 
                                 'X-IBM-Client-Id' = '123',
                                 'Authorization: Bearer'="")))

and I'm trying to translate this code into R program, but I end up with the following error:

curl -v -X POST -H "X-IBM-Client-Id:YOUR_CLIENT_ID" -H "X-IBM-Client-Secret:YOUR_CLIENT_SECRET" -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type:application/json" -H "Accept:application/json" https://api.ibm.com/watsonanalytics/run/data/v1/datasets -d '{ "description" :"1234" , "name" :"1234" }

Nov 2, 2018 in Data Analytics by Ali
• 11,360 points
811 views

1 answer to this question.

0 votes
Use the RCurl library, its always a good habit to use mention the libraries that you'll be needing before it starts throwing error.
answered Nov 2, 2018 by Maverick
• 10,840 points

Related Questions In Data Analytics

0 votes
2 answers

Transforming a key/value string into distinct rows in R

We would start off by loading the ...READ MORE

answered Mar 26, 2018 in Data Analytics by Bharani
• 4,660 points
1,180 views
0 votes
1 answer

How can I import multiple .csv files into R ?

## import_multiple_csv_files_to_R # Purpose: Import multiple csv files ...READ MORE

answered Apr 20, 2018 in Data Analytics by zombie
• 3,790 points
6,246 views
0 votes
1 answer

How to import data from a Json file into R?

Easy and simple: library("rjson") json_file <- "file_name" json_data <- fromJSON(file=json_file)) or ...READ MORE

answered Apr 26, 2018 in Data Analytics by DeepCoder786
• 1,720 points
2,359 views
+1 vote
2 answers

Splitting the data into training and testing sets - R

Hi, Try like this. train = sample(x = ...READ MORE

answered Aug 21, 2019 in Data Analytics by anonymous
• 33,030 points
6,129 views
0 votes
1 answer

By using dpylr package sum of multiple columns

Basically here we are making an equation ...READ MORE

answered Apr 5, 2018 in Data Analytics by DeepCoder786
• 1,720 points
2,250 views
0 votes
1 answer

How to convert a text mining termDocumentMatrix into excel or csv in R?

By assuming that all the values are ...READ MORE

answered Apr 5, 2018 in Data Analytics by DeepCoder786
• 1,720 points
1,920 views
0 votes
1 answer

In a dpylr pipline how to use sample and seq?

For avoiding rowwise(), I prefer to use ...READ MORE

answered Apr 6, 2018 in Data Analytics by DeepCoder786
• 1,720 points

edited Jun 9, 2020 by Gitika 1,182 views
0 votes
1 answer

How to create a list of Data frames?

Basically all we have to do is ...READ MORE

answered Apr 9, 2018 in Data Analytics by DeepCoder786
• 1,720 points
1,341 views
+1 vote
2 answers
0 votes
1 answer

how do I run this R program on hadoop.

You can use hadoop streaming to read ...READ MORE

answered Nov 16, 2018 in Data Analytics by Maverick
• 10,840 points
1,026 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP