Running ‘testthat.R’ [17s/132s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > library(testthat)
  > library(rclinicaltrials)
  > 
  > test_check("rclinicaltrials")
  1. Error: download function returns correct format (@test-download.R#28) -------
  $ operator is invalid for atomic vectors
  1: clinicaltrials_download(query = "heart disease AND stroke AND California", count = 5, 
         include_results = TRUE) at testthat/test-download.R:28
  2: lapply(xml_list, function(file) gather_results(XML::xmlParse(file)))
  3: FUN(X[[i]], ...)
  4: gather_results(XML::xmlParse(file))
  5: do.call(plyr::rbind.fill, XML::xmlApply(measures, function(node) {
         lank <- XML::xmlSApply(node, function(n) {
             if (XML::xmlName(n) == "category_list") {
                 do.call(plyr::rbind.fill, XML::xmlApply(n, function(n0) {
                     tmpRes <- XML::xmlApply(n0[["measurement_list"]], function(x) {
                       as.data.frame(t(XML::xmlAttrs(x)), stringsAsFactors = FALSE)
                     })
                     ResAdd <- do.call(plyr::rbind.fill, tmpRes)
                     data.frame(cbind(subtitle = XML::xmlValue(n0), ResAdd, stringsAsFactors = FALSE), 
                       row.names = NULL, stringsAsFactors = FALSE)
                 }))
             }
             else if (XML::xmlName(n) == "class_list") {
                 do.call(plyr::rbind.fill, XML::xmlApply(n, function(n0) {
                     subtitle <- XML::xmlValue(n0[["title"]])
                     tmpRes <- XML::xmlApply(n0[["category_list"]][["category"]][["measurement_list"]], 
                       function(x) {
                         as.data.frame(t(XML::xmlAttrs(x)), stringsAsFactors = FALSE)
                       })
                     ResAdd <- do.call(plyr::rbind.fill, tmpRes)
                     data.frame(cbind(subtitle = subtitle, ResAdd, stringsAsFactors = FALSE), 
                       row.names = NULL, stringsAsFactors = FALSE)
                 }))
             }
             else {
                 XML::xmlValue(n)
             }
         })
         names(lank)[names(lank) == "class_list"] <- "category_list"
         target <- lank$category_list
         fillout <- lank[names(lank) != "category_list"]
         cbind(fillout, target)
     }))
  6: XML::xmlApply(measures, function(node) {
         lank <- XML::xmlSApply(node, function(n) {
             if (XML::xmlName(n) == "category_list") {
                 do.call(plyr::rbind.fill, XML::xmlApply(n, function(n0) {
                     tmpRes <- XML::xmlApply(n0[["measurement_list"]], function(x) {
                       as.data.frame(t(XML::xmlAttrs(x)), stringsAsFactors = FALSE)
                     })
                     ResAdd <- do.call(plyr::rbind.fill, tmpRes)
                     data.frame(cbind(subtitle = XML::xmlValue(n0), ResAdd, stringsAsFactors = FALSE), 
                       row.names = NULL, stringsAsFactors = FALSE)
                 }))
             }
             else if (XML::xmlName(n) == "class_list") {
                 do.call(plyr::rbind.fill, XML::xmlApply(n, function(n0) {
                     subtitle <- XML::xmlValue(n0[["title"]])
                     tmpRes <- XML::xmlApply(n0[["category_list"]][["category"]][["measurement_list"]], 
                       function(x) {
                         as.data.frame(t(XML::xmlAttrs(x)), stringsAsFactors = FALSE)
                       })
                     ResAdd <- do.call(plyr::rbind.fill, tmpRes)
                     data.frame(cbind(subtitle = subtitle, ResAdd, stringsAsFactors = FALSE), 
                       row.names = NULL, stringsAsFactors = FALSE)
                 }))
             }
             else {
                 XML::xmlValue(n)
             }
         })
         names(lank)[names(lank) == "class_list"] <- "category_list"
         target <- lank$category_list
         fillout <- lank[names(lank) != "category_list"]
         cbind(fillout, target)
     })
  7: xmlApply.XMLInternalNode(measures, function(node) {
         lank <- XML::xmlSApply(node, function(n) {
             if (XML::xmlName(n) == "category_list") {
                 do.call(plyr::rbind.fill, XML::xmlApply(n, function(n0) {
                     tmpRes <- XML::xmlApply(n0[["measurement_list"]], function(x) {
                       as.data.frame(t(XML::xmlAttrs(x)), stringsAsFactors = FALSE)
                     })
                     ResAdd <- do.call(plyr::rbind.fill, tmpRes)
                     data.frame(cbind(subtitle = XML::xmlValue(n0), ResAdd, stringsAsFactors = FALSE), 
                       row.names = NULL, stringsAsFactors = FALSE)
                 }))
             }
             else if (XML::xmlName(n) == "class_list") {
                 do.call(plyr::rbind.fill, XML::xmlApply(n, function(n0) {
                     subtitle <- XML::xmlValue(n0[["title"]])
                     tmpRes <- XML::xmlApply(n0[["category_list"]][["category"]][["measurement_list"]], 
                       function(x) {
                         as.data.frame(t(XML::xmlAttrs(x)), stringsAsFactors = FALSE)
                       })
                     ResAdd <- do.call(plyr::rbind.fill, tmpRes)
                     data.frame(cbind(subtitle = subtitle, ResAdd, stringsAsFactors = FALSE), 
                       row.names = NULL, stringsAsFactors = FALSE)
                 }))
             }
             else {
                 XML::xmlValue(n)
             }
         })
         names(lank)[names(lank) == "class_list"] <- "category_list"
         target <- lank$category_list
         fillout <- lank[names(lank) != "category_list"]
         cbind(fillout, target)
     })
  8: lapply(kids, FUN, ...)
  9: FUN(X[[i]], ...)
  
  testthat results ================================================================
  OK: 13 SKIPPED: 0 FAILED: 1
  1. Error: download function returns correct format (@test-download.R#28) 
  
  Error: testthat unit tests failed
  Execution halted