Learn R Programming

monkeylearn (version 0.1.0)

monkeylearn_classify: monkeylearn_classify

Description

Access to Monkeylearn classifiers modules

Usage

monkeylearn_classify(request, key = monkeylearn_key(quiet = TRUE), classifier_id = "cl_oFKL5wft", verbose = FALSE)

Arguments

request
A vector of characters (each text smaller than 50kB)
key
The API key
classifier_id
The ID of the classifier
verbose
whether to output messages about batch requests

Value

A data.frame with the results whose attribute is a data.frame "headers" including the number of remaining queries as "x.query.limit.remaining". Both data.frames include a column with the (list of) md5 checksum(s) of the corresponding text(s) computed using the digest digest function.

Details

Find IDs of classifiers using https://app.monkeylearn.com/main/explore.

You can use batch to send up to 200 texts to be analyzed within the API (classification or extraction) with each request. So for example, if you need to analyze 6000 tweets, instead of doing 6000 requests to the API, you can use batch to send 30 requests, each request with 200 tweets. The function automatically makes these batch calls and waits if there is a throttle limit error, but you might want to control the process yourself using several calls to the function.

You can check the number of calls you can still make in the API using attr(output, "headers")$x.query.limit.remaining and attr(output, "headers")$x.query.limit.limit.

Examples

Run this code
## Not run: 
# text1 <- "my dog is an avid rice eater"
# text2 <- "i want to buy an iphone"
# request <- c(text1, text2)
# output <- monkeylearn_classify(request)
# output
# attr(output, "headers")## End(Not run)

Run the code above in your browser using DataLab