Skip to content

Commit

Permalink
hide internal functions
Browse files Browse the repository at this point in the history
  • Loading branch information
rafapereirabr committed Aug 9, 2022
1 parent 140a063 commit 251af69
Show file tree
Hide file tree
Showing 14 changed files with 23 additions and 91 deletions.
2 changes: 1 addition & 1 deletion r-package/DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ Imports:
httr (>= 1.4.1),
sf (>= 0.9-3),
utils
RoxygenNote: 7.2.0
RoxygenNote: 7.2.1
Roxygen: list(markdown = TRUE)
VignetteBuilder: knitr
7 changes: 0 additions & 7 deletions r-package/NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
# Generated by roxygen2: do not edit by hand

export(cep_to_state)
export(check_connection)
export(download_gpkg)
export(download_metadata)
export(list_geobr)
export(load_gpkg)
export(lookup_muni)
export(read_amazon)
export(read_biomes)
Expand Down Expand Up @@ -34,9 +30,6 @@ export(read_statistical_grid)
export(read_urban_area)
export(read_urban_concentrations)
export(read_weighting_area)
export(select_data_type)
export(select_metadata)
export(select_year_input)
importFrom(curl,"has_internet")
importFrom(data.table,"%like%")
importFrom(utils,"tail")
3 changes: 1 addition & 2 deletions r-package/R/download_metadata.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#' Support function to download metadata internally used in geobr
#'
#' @export
#' @family general support functions
#' @keywords internal
#' @examples \dontrun{ if (interactive()) {
#' df <- download_metadata()
#' }}
Expand Down
20 changes: 6 additions & 14 deletions r-package/R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
#'
#' @param temp_meta A dataframe with the file_url addresses of geobr datasets
#' @param simplified Logical TRUE or FALSE indicating whether the function returns the 'original' dataset with high resolution or a dataset with 'simplified' borders (Defaults to TRUE)
#' @export
#' @family support functions
#' @keywords internal
#'
select_data_type <- function(temp_meta, simplified=NULL){

Expand All @@ -29,12 +28,9 @@ select_data_type <- function(temp_meta, simplified=NULL){

#' Select year input
#'
#'
#'
#' @param temp_meta A dataframe with the file_url addresses of geobr datasets
#' @param y Year of the dataset (passed by red_ function)
#' @export
#' @family support functions
#' @keywords internal
#'
select_year_input <- function(temp_meta, y=year){

Expand All @@ -60,8 +56,7 @@ select_year_input <- function(temp_meta, y=year){
#' @param simplified Logical TRUE or FALSE indicating whether the function returns the 'original' dataset with high resolution or a dataset with 'simplified' borders (Defaults to TRUE)
#' @param year Year of the dataset (passed by red_ function)
#'
#' @export
#' @family support functions
#' @keywords internal
#' @examples \dontrun{ if (interactive()) {
#'
#' library(geobr)
Expand Down Expand Up @@ -97,8 +92,7 @@ select_metadata <- function(geography, year=NULL, simplified=NULL){
#'
#' @param file_url A string with the file_url address of a geobr dataset
#' @param progress_bar Logical. Defaults to (TRUE) display progress bar
#' @export
#' @family support functions
#' @keywords internal
#'
download_gpkg <- function(file_url, progress_bar = showProgress){

Expand Down Expand Up @@ -237,8 +231,7 @@ download_gpkg <- function(file_url, progress_bar = showProgress){
#'
#' @param file_url A string with the file_url address of a geobr dataset
#' @param temps The address of a gpkg file stored in tempdir. Defaults to NULL
#' @export
#' @family support functions
#' @keywords internal
#'
load_gpkg <- function(file_url, temps=NULL){

Expand Down Expand Up @@ -278,8 +271,7 @@ load_gpkg <- function(file_url, temps=NULL){
#'
#' @return Logical. `TRUE` if url is working, `FALSE` if not.
#'
#' @export
#' @family support functions
#' @keywords internal
#'
check_connection <- function(file_url = 'https://www.ipea.gov.br/geobr/metadata/metadata_gpkg.csv'){

Expand Down
10 changes: 1 addition & 9 deletions r-package/man/check_connection.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 1 addition & 9 deletions r-package/man/download_gpkg.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 1 addition & 5 deletions r-package/man/download_metadata.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions r-package/man/list_geobr.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 1 addition & 9 deletions r-package/man/load_gpkg.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 1 addition & 9 deletions r-package/man/select_data_type.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 1 addition & 9 deletions r-package/man/select_metadata.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 1 addition & 9 deletions r-package/man/select_year_input.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions r-package/tests/testthat.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
if (requireNamespace("testthat", quietly = TRUE)) {

library(testthat)
library(geobr)
library(sf)

test_check("geobr")

}
8 changes: 4 additions & 4 deletions r-package/tests/testthat/test-check_connection.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ skip_if(Sys.getenv("TEST_ONE") != "")
testthat::skip_on_cran()


url_ok <- 'http://google.com/'
url_timeout <- 'http://www.google.com:81/'
url_error <- 'http://httpbin.org/status/300'
url_ok <- 'https://google.com/'
url_timeout <- 'https://www.google.com:81/'
url_error <- 'https://httpbin.org/status/300'


# expected success ------------------------------------
test_that("check_connection", {

testthat::expect_true(check_connection(file_url = url_ok) )
testthat::expect_true( check_connection(file_url = url_ok) )
})


Expand Down

0 comments on commit 251af69

Please sign in to comment.