rOpenGov / rtimes

R wrapper for NYTimes API for government data - ABANDONED

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Boolean terms in query?

comstock opened this issue · comments

My query, used for over a year, stopped returning the same quantity of results.

May I use (continue to use) AND and OR terms in my query? Is the following incorrectly formulated?

q.cc <- "\"constitutional crisis\" AND \"Trump\" NOT \"Korea\" NOT \"Lula\" NOT \"Catalonia \""

trumpCC <- as_search( q = q.cc, begin_date = begin.date.var, end_date = today, sort = "newest", hl = TRUE, facet_field = "section_name", facet_filter = TRUE)

can you share your R session info please. and do you know what version of this package you were using when it did work for you?

can you share your R session info please. and do you know what version of this package you were using when it did work for you?

Is this what you're asking for? Appreciate and advice.

R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin13.4.0 (64-bit)

> packageDescription("rtimes")
Package: rtimes
Title: Client for New York Times 'APIs'
Description: Interface to Congress, Campaign Finance, Article Search, and Geographic 'APIs' from the New York Times
             (<http://developer.nytimes.com/>) and 'ProPublica' (<https://www.propublica.org/datastore/apis>). This
             client covers a subset of the New York Times and 'ProPublica' 'APIs'.
Version: 0.5.0
License: MIT + file LICENSE
Authors@R: person("Scott", "Chamberlain", role = c("aut", "cre"), email = "myrmecocystus@gmail.com")
URL: https://github.com/ropengov/rtimes
BugReports: https://github.com/ropengov/rtimes/issues
VignetteBuilder: knitr
Imports: utils, crul (>= 0.3.8), jsonlite, dplyr, tibble, data.table
Suggests: roxygen2 (>= 6.0.1), knitr, testthat, lubridate, ggplot2, scales, grid
RoxygenNote: 6.0.1
NeedsCompilation: no
Packaged: 2017-08-11 21:42:23 UTC; sacmac
Author: Scott Chamberlain [aut, cre]
Maintainer: Scott Chamberlain <myrmecocystus@gmail.com>
Repository: CRAN
Date/Publication: 2017-08-11 21:49:33 UTC
Built: R 3.3.2; ; 2017-08-12 16:25:49 UTC; unix

@comstock that works sorta, but was looking for the output of sessionInfo()

R version 3.3.2 (2016-10-31)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X Yosemite 10.10.5

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] scales_0.5.0  ggplot2_2.2.1 dplyr_0.7.4   plyr_1.8.4    jsonlite_1.5  random_0.2.6  stringr_1.3.1 rtimes_0.5.0 

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.17     bindr_0.1.1      magrittr_1.5     munsell_0.4.3    colorspace_1.3-2 R6_2.2.2         rlang_0.2.0     
 [8] tools_3.3.2      grid_3.3.2       gtable_0.2.0     pacman_0.4.6     yaml_2.1.19      lazyeval_0.2.1   assertthat_0.2.0
[15] httpcode_0.2.0   tibble_1.4.2     bindrcpp_0.2.2   triebeard_0.3.0  curl_3.2         crul_0.5.2       glue_1.2.0      
[22] labeling_0.3     stringi_1.2.2    pillar_1.2.2     urltools_1.7.0   pkgconfig_2.0.1 

What or how many results do you expect to see?

Have you tried http://developer.nytimes.com/article_search_v2.json#/Console yet, it's a nice way to fiddle with queries to make sure it's the API working or not working, and not related to this R package.

Does this do what you want? using fq instead of q, a filter query instead of query

q.cc <- "\"constitutional crisis\" AND \"Trump\" NOT \"Korea\" NOT \"Lula\" NOT \"Catalonia\""
as_search(q = NULL, fq = q.cc, begin_date = "20180101", end_date = "20180501", 
    sort = "newest", hl = TRUE, facet_field = "section_name", facet_filter = TRUE)

closing due to inactivity