Skip to content

Commit af756b8

Browse files
authored
Merge pull request #3 from QuantGov/dev
final codebase with all the fixes and cran compliances
2 parents 02012a2 + 7e94c81 commit af756b8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+112
-104
lines changed

DESCRIPTION

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
Type: Package
22
Package: regcensus
3-
Title: Accessing Data from the RegCensusAPI
3+
Title: Accessing Data from the 'RegCensusAPI'
44
Version: 1.0.0
5-
Author: QuantGov
6-
Maintainer: QuantGov <info@quantgov.org>
7-
Description: Allowing users to access data from the RegCensusAPI. The RegCensusAPI is an API client that connects to the RegData regulatory restrictions data by the Mercatus Center at George Mason University. RegData uses machine learning algorithms to quantify the number of regulatory restrictions in a jurisdiction. You can find out more about RegData from 'QuantGov website' <https://www.quantgov.org>.
5+
Authors@R: c(
6+
person("Jonathan", "Nelson", , "jnelson@mercatus.gmu.edu",
7+
role = c("aut", "cre")),
8+
person("Thurston", "Powers", , "tpowers@mercatus.gmu.edu",
9+
role = c("aut")),
10+
person("Aayush", "Gadia", , "agadia@mercatus.gmu.edu",
11+
role = c("aut")),
12+
person("Mercatus Center", email = "info@quantgov.org",
13+
role = c("cph", "fnd")))
14+
Description: Allowing users to access data from the 'RegCensusAPI'. The 'RegCensusAPI' is an API client that connects to the 'RegData' regulatory restrictions data by the 'Mercatus Center' at 'George Mason University'. 'RegData' uses machine learning algorithms to quantify the number of regulatory restrictions in a jurisdiction. You can find out more about 'RegData' from 'QuantGov website' <https://www.quantgov.org>.
815
License: MIT+ file LICENSE
916
URL: https://github.com/QuantGov/regcensus-api-client-R
1017
BugReports: https://github.com/QuantGov/regcensus-api-client-R/issues

R/agency_url.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#' @param keyword search for keyword in agency name
66
#' @return url as a string
77
#' @examples
8-
#' agency_url(jurisdiction_id = 38, keyword = "test_word")
8+
#' \dontrun{agency_url(jurisdiction_id = 38, keyword = "test_word")}
99
#' @import jsonlite
1010
#' @import stringr
1111
#' @import httr
@@ -20,7 +20,7 @@ agency_url <- function(jurisdiction_id, keyword) {
2020
} else if (!is.null(jurisdiction_id)) {
2121
url_call <- paste0(url, "/agencies?", "jurisdiction=", jurisdiction_id)
2222
} else {
23-
print("Must include either 'jurisdiction_id' or 'keyword.'")
23+
message("Must include either 'jurisdiction_id' or 'keyword.'")
2424
return()
2525
}
2626
return(url_call)

R/get_agencies.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#' @param verbose prints out the url of the API call, default value of 0
77
#' @return Returns pandas dataframe with the metadata
88
#' @examples
9-
#' get_agencies(jurisdiction_id = 38, keyword = "test")
9+
#' \dontrun{get_agencies(jurisdiction_id = 38, keyword = "test")}
1010
#' @import jsonlite
1111
#' @import stringr
1212
#' @import httr
@@ -17,7 +17,7 @@
1717
get_agencies <- function(jurisdiction_id = NULL, keyword = NULL, verbose = 0) {
1818
url_call <- agency_url(jurisdiction_id, keyword)
1919
if (verbose) {
20-
print(paste0("API call: ", url_call))
20+
message(paste0("API call: ", url_call))
2121
}
2222
output <- clean_columns(fromJSON(content(GET(url_call), as = "parsed")))
2323
return(output)

R/get_datafinder.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#' @return Returns dataframe with the series and years available,
77
#' along with the endpoints to access the data
88
#' @examples
9-
#' get_datafinder(jurisdiction = 38)
9+
#' \dontrun{get_datafinder(jurisdiction = 1)}
1010
#' @import httr
1111
#' @import jsonlite
1212
#' @import stats

R/get_document_values.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@
3535
#' default value is 0
3636
#' @return Returns pandas dataframe with the metadata
3737
#' @examples
38-
#' get_document_values(
38+
#' \dontrun{get_document_values(
3939
#' series = 33, jurisdiction = 38,
4040
#' year = 2018, label = "111"
41-
#' )
41+
#' )}
4242
#' @import jsonlite
4343
#' @import stringr
4444
#' @import httr

R/get_documentation.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#' documentation, the source name, source citation,
66
#' source url and documentation.
77
#' @examples
8-
#' get_documentation()
8+
#' \dontrun{get_documentation()}
99
#' @import jsonlite
1010
#' @import stringr
1111
#' @import httr

R/get_documents.R

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#' @param verbose prints out the url of the API call, default value of 0
1010
#' @return Returns pandas dataframe with the metadata
1111
#' @examples
12-
#' get_documents(jurisdiction_id = 38, date = 2018)
12+
#' \dontrun{get_documents(jurisdiction_id = 38, date = 2022)}
1313
#' @import jsonlite
1414
#' @import stringr
1515
#' @import httr
@@ -20,18 +20,18 @@
2020
get_documents <- function(document_id = NULL, jurisdiction_id = NULL,
2121
date = NULL, document_type = 1, verbose = 0) {
2222
if (!is.null(document_id)) {
23-
message <- paste0("document_id is no longer accessible as of version 1.0.",
24-
" Use previous version of API or use jurisdiction_id",
25-
" and date combination")
26-
print(message)
23+
text <- paste0("document_id is no longer accessible as of version 1.0.",
24+
" Use previous version of API or use jurisdiction_id",
25+
" and date combination")
26+
message(text)
2727
return()
2828
} else if (!is.null(jurisdiction_id) && !is.null(date)) {
2929
return(get_values(series = 1, jurisdiction = jurisdiction_id,
3030
year = date,
3131
document_type = document_type,
3232
summary = FALSE))
3333
} else {
34-
print("Must include jurisdiction_id and date")
34+
message("Must include jurisdiction_id and date")
3535
return()
3636
}
3737
}

R/get_endpoint.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
#' @return Returns the endpoint, e.g. '/state-summary' for summary-level state
1212
#' data
1313
#' @examples
14-
#' get_endpoint(
14+
#' \dontrun{get_endpoint(
1515
#' series = c(28, 33, 36), jurisdiction = 38,
1616
#' year = c(1970, 2003, 2004, 2018), document_type = 1
17-
#' )
17+
#' )}
1818
#' @import jsonlite
1919
#' @import stringr
2020
#' @import httr

R/get_industries.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#' @param verbose prints out the url of the API call, default value of 0
88
#' @return Returns pandas dataframe with the metadata
99
#' @examples
10-
#' get_industries()
10+
#' \dontrun{get_industries()}
1111
#' @import jsonlite
1212
#' @import stringr
1313
#' @import httr
@@ -19,7 +19,7 @@ get_industries <- function(keyword = NULL, label_level = 3,
1919
label_source = NULL, verbose = 0) {
2020
url_call <- industries_url(keyword, label_level, label_source)
2121
if (verbose) {
22-
print(paste0("API call: ", url_call))
22+
message(paste0("API call: ", url_call))
2323
}
2424
output <- clean_columns(fromJSON(content(GET(url_call), as = "parsed")))
2525
return(output)

R/get_jurisdictions.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#' @param verbose prints out the url of the API call, default value of 0
55
#' @return Returns pandas dataframe with the metadata
66
#' @examples
7-
#' get_jurisdictions()
7+
#' \dontrun{get_jurisdictions()}
88
#' @import jsonlite
99
#' @import stringr
1010
#' @import httr
@@ -15,7 +15,7 @@
1515
get_jurisdictions <- function(verbose = 0) {
1616
url_call <- jurisdictions_url()
1717
if (verbose) {
18-
print(paste0("API call: ", url_call))
18+
message(paste0("API call: ", url_call))
1919
}
2020
output <- clean_columns(fromJSON(content(GET(url_call), as = "parsed")))
2121
return(output)

0 commit comments

Comments
 (0)