Skip to content
This repository has been archived by the owner on May 10, 2022. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
maelle committed Aug 5, 2016
1 parent c3218dc commit f4789cd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion R/classify.R
Expand Up @@ -42,7 +42,7 @@ monkeylearn_classify <- function(request, key = monkeylearn_key(quiet = TRUE),
results <- NULL
headers <- NULL

for(i in 1:length(request)) {
for(i in seq_along(request)) {

if(verbose) {
message(paste0("Processing request number ", i, " out of ", length(request)))
Expand Down
2 changes: 1 addition & 1 deletion R/extractor.R
Expand Up @@ -67,7 +67,7 @@ monkeylearn_extract <- function(request, key = monkeylearn_key(quiet = TRUE),
results <- NULL
headers <- NULL

for(i in 1:length(request)) {
for(i in seq_along(request)) {
if(verbose) {
message(paste0("Processing request number ", i, " out of ", length(request)))
}
Expand Down
6 changes: 4 additions & 2 deletions R/utils.R
Expand Up @@ -52,7 +52,8 @@ monkeylearn_url_extractor <- function(extractor_id) {
# check text size
monkeylearn_text_size <- function(request) {

if(any(unlist(lapply(request, nchar, type = "bytes")) > 500000)) {
if(any(unlist(vapply(request, nchar, type = "bytes",
FUN.VALUE = 0)) > 500000)) {
stop("Each text in the request should be smaller than 500 kb.",
call. = FALSE)
}
Expand Down Expand Up @@ -98,7 +99,8 @@ monkeylearn_parse <- function(output, request_text) {
digest::digest, algo = "md5",
simplify = TRUE,
USE.NAMES = FALSE),
unlist(lapply(temp$result, nrow)),
unlist(vapply(temp$result, nrow,
FUN.VALUE = 0)),
SIMPLIFY = FALSE))
} else{
results <- as.data.frame(temp$result)
Expand Down

0 comments on commit f4789cd

Please sign in to comment.