Skip to content

Commit

Permalink
adding returns statement to .Rd files
Browse files Browse the repository at this point in the history
  • Loading branch information
bczernecki committed Oct 18, 2024
1 parent 3917713 commit 7f05f4f
Show file tree
Hide file tree
Showing 39 changed files with 83 additions and 65 deletions.
2 changes: 2 additions & 0 deletions R/check_locale.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#' in the Polish metservice's repository and therefore will be forced to
#' use ASCII//TRANSLIT
#' @noRd
#' @keywords internal
#' @return 1 if the locale is not UTF-8, 0 otherwise

check_locale = function() {

Expand Down
1 change: 1 addition & 0 deletions R/clean_metadata_hydro.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#' @param interval temporal interval
#' @importFrom utils read.fwf
#' @keywords internal
#' @noRd

clean_metadata_hydro = function(address, interval) {
temp = tempfile()
Expand Down
9 changes: 1 addition & 8 deletions R/clean_metadata_meteo.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,12 @@
#' @importFrom stats na.omit
#' @importFrom stringi stri_trans_general
#' @keywords internal
#'
#' @noRd

clean_metadata_meteo = function(address, rank = "synop", interval = "hourly") {

temp = tempfile()
test_url(link = address, output = temp)

# a = readLines(temp, warn = FALSE, encoding = "CP1250") # doesn't work on mac,
# thus:
# a = iconv(a, from = "CP1250", to = "ASCII//TRANSLIT")
a = read.csv(temp, header = FALSE, stringsAsFactors = FALSE,
fileEncoding = "CP1250")$V1
a = gsub(a, pattern = "\\?", replacement = "")
Expand All @@ -27,9 +23,6 @@ clean_metadata_meteo = function(address, rank = "synop", interval = "hourly") {
a = gsub(x = a, pattern = "'", replacement = "")
a = gsub(x = a, pattern = "\\^0", replacement = "")
a = data.frame(V1 = a[nchar(a) > 3], stringsAsFactors = FALSE)
# this one does not work on windows
# a = suppressWarnings(na.omit(read.fwf(address, widths = c(1000),
# fileEncoding = "CP1250", stringsAsFactors = FALSE)))
length_char = max(nchar(a$V1), na.rm = TRUE)

if (rank == "precip" && interval == "hourly") length_char = 40 # exception for precip / hourly
Expand Down
1 change: 1 addition & 0 deletions R/co2_demo.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#' @docType data
#' @keywords datasets meteo
#' @examples
#' @returns data.frame with historical CO2 concentrations
#' data(co2_demo)
#' head(co2_demo)
"co2_demo"
2 changes: 1 addition & 1 deletion R/hydro_imgw.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#' @return A data.frame with columns describing the hydrological parameters
#' (e.g. flow, water level) where each row represent a measurement,
#' depending on the interval, at a given hour, month or year.
#' If `coords = TRUE` additional two columns with geografic coordinates are added.
#' If `coords = TRUE` additional two columns with geographic coordinates are added.
#' @examples
#' \donttest{
#' x = hydro_imgw("monthly", year = 1999)
Expand Down
1 change: 1 addition & 0 deletions R/hydro_imgw_annual.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#' @importFrom utils download.file unzip read.csv
#' @importFrom data.table fread
#' @export
#' @returns data.frame with historical hydrological data for the semi-annual and annual period
#' @examples
#' \donttest{
#' hydro_yearly = hydro_imgw_annual(year = 2000, value = "H", station = "ANNOPOL")
Expand Down
2 changes: 1 addition & 1 deletion R/hydro_imgw_daily.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#' @importFrom utils download.file unzip read.csv
#' @importFrom data.table fread
#' @export
#'
#' @returns data.frame with historical hydrological data for the daily time interval
#' @examples \donttest{
#' daily = hydro_imgw_daily(year = 2000)
#' }
Expand Down
1 change: 1 addition & 0 deletions R/hydro_imgw_monthly.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#' @importFrom utils download.file unzip read.csv
#' @importFrom data.table fread
#' @export
#' @returns data.frame with historical hydrological data for the monthly summaries
#'
#' @examples \donttest{
#' monthly = hydro_imgw_monthly(year = 2000)
Expand Down
1 change: 1 addition & 0 deletions R/hydro_shortening_imgw.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#' @param remove_duplicates whether to remove duplicated column names
#' (default TRUE - i.e., columns with duplicated names are deleted)
#' @export
#' @returns data.frame with shorten names of hydrological parameters
#' @examples
#' \donttest{
#' monthly = data = hydro_imgw("monthly", year = 1969, col_names = "polish")
Expand Down
1 change: 1 addition & 0 deletions R/meteo_imgw_daily.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#' @importFrom XML readHTMLTable
#' @importFrom utils download.file unzip read.csv
#' @importFrom data.table fread
#' @returns data.frame with a daily meteorological measurements
#' @export
#'
#' @examples \donttest{
Expand Down
2 changes: 1 addition & 1 deletion R/meteo_imgw_datastore.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#' @param allow_failure logical - whether to proceed or stop on failure. By default set to TRUE (i.e. don't stop on error). For debugging purposes change to FALSE
#' @import data.table
#' @export
#'
#' @returns data.frame with a raw meteorological measurements in 10-min intervals
#' @examples
#' \donttest{
#' imgw_telemetry = meteo_imgw_datastore(year = 2022:2023,
Expand Down
1 change: 1 addition & 0 deletions R/meteo_imgw_hourly.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#' @importFrom utils download.file unzip read.csv
#' @importFrom data.table fread
#' @export
#' @return meteorological data for the hourly time interval
#'
#' @examples \donttest{
#' hourly = meteo_imgw_hourly(rank = "climate", year = 1984)
Expand Down
1 change: 1 addition & 0 deletions R/meteo_imgw_monthly.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#' @importFrom utils unzip read.csv
#' @importFrom data.table fread
#' @export
#' @return meteorological data with monthly summaries
#'
#' @examples
#' \donttest{
Expand Down
1 change: 1 addition & 0 deletions R/meteo_noaa_co2.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#' @importFrom utils read.table
#' @importFrom utils data
#' @export
#' @returns Data frame with historical CO2 concentrations
#'
#' @examples
#' \donttest{
Expand Down
1 change: 1 addition & 0 deletions R/meteo_noaa_hourly.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#' @param allow_failure logical - whether to proceed or stop on failure. By default set to TRUE (i.e. don't stop on error). For debugging purposes change to FALSE
#' @importFrom utils download.file unzip read.csv
#' @export
#' @returns data.frame with historical meteorological data in hourly intervals
#'
#' @examples
#' \donttest{
Expand Down
1 change: 1 addition & 0 deletions R/meteo_shortening_imgw.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#' @param col_names three types of column names possible: "short" - default, values with shorten names, "full" - full English description, "polish" - original names in the dataset
#' @param remove_duplicates whether to remove duplicated column names (default TRUE - i.e., columns with duplicated names are deleted)
#' @export
#' @returns data.frame with modified names of meteorological parameters
#'
#' @examples
#' \donttest{
Expand Down
1 change: 1 addition & 0 deletions R/ogimet_daily.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#' @importFrom utils setTxtProgressBar txtProgressBar
#'
#' @export
#' @returns data.frame with historical meteorological data for the daily summaries
#'
#' @examples
#' \donttest{
Expand Down
1 change: 1 addition & 0 deletions R/ogimet_hourly.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#' @export
#'
#' @keywords internal
#' @returns data.frame with historical meteorological data for hourly time interval
#'
#' @examples
#' \donttest{
Expand Down
7 changes: 3 additions & 4 deletions R/spheroid_dist.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@
#' @param p1 coordinates of the first point in decimal degrees (LON, LAT)
#' @param p2 coordinates of the second point in decimal degrees (LON, LAT)
#'
#' @return distance between two locations (in kilometers)
#' @return numerical vector with distance between two locations (in kilometers)
#' @export

#' @examples
#' p1 = c(18.633333, 54.366667) # longitude and latitude for Gdansk
#' p2 = c(17.016667, 54.466667) # longitude and latitude for Slupsk
#' p1 = c(18.633333, 54.366667) # longitude and latitude for Gdansk, PL
#' p2 = c(17.016667, 54.466667) # longitude and latitude for Slupsk, PL
#' spheroid_dist(p1, p2)
#'
spheroid_dist = function(p1, p2) {
Expand Down
10 changes: 6 additions & 4 deletions R/test_url.R
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
#' Download file in a graceful way
#'
#' Function for downloading & testing url/internet connection according to CRAN policy
#' Example solution strongly based on https://community.rstudio.com/t/internet-resources-should-fail-gracefully/49199/12
#' Example solution strongly based on
#' https://community.rstudio.com/t/internet-resources-should-fail-gracefully/49199/12
#' as suggested by kvasilopoulos
#'
#' @param link character vector with URL to check
#' @param output character vector for output file name
#' @param quiet logical vector (TRUE or FALSE) to be passed to curl_download function. FALSE by default
#' @param quiet logical vector (TRUE or FALSE) to be passed to curl_download function.
#' FALSE by default
#'
#' @importFrom curl curl_download
#' @importFrom curl has_internet
#' @import httr
#'
#' @return No return value, called for side effects
#' @export
#'
#' @examples
Expand All @@ -25,7 +27,7 @@


test_url = function(link, output, quiet = FALSE) {
print(link)
#print(link)
try_GET = function(x, ...) {
tryCatch(
curl::curl_download(url = link, destfile = output, mode = "wb", quiet = quiet, ...),
Expand Down
17 changes: 0 additions & 17 deletions man/clean_metadata_hydro.Rd

This file was deleted.

19 changes: 0 additions & 19 deletions man/clean_metadata_meteo.Rd

This file was deleted.

9 changes: 5 additions & 4 deletions man/co2_demo.Rd

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

2 changes: 1 addition & 1 deletion man/hydro_imgw.Rd

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

3 changes: 3 additions & 0 deletions man/hydro_imgw_annual.Rd

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

3 changes: 3 additions & 0 deletions man/hydro_imgw_daily.Rd

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

3 changes: 3 additions & 0 deletions man/hydro_imgw_monthly.Rd

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

3 changes: 3 additions & 0 deletions man/hydro_shortening_imgw.Rd

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

3 changes: 3 additions & 0 deletions man/meteo_imgw_daily.Rd

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

3 changes: 3 additions & 0 deletions man/meteo_imgw_datastore.Rd

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

3 changes: 3 additions & 0 deletions man/meteo_imgw_hourly.Rd

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

3 changes: 3 additions & 0 deletions man/meteo_imgw_monthly.Rd

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

3 changes: 3 additions & 0 deletions man/meteo_noaa_co2.Rd

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

3 changes: 3 additions & 0 deletions man/meteo_noaa_hourly.Rd

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

3 changes: 3 additions & 0 deletions man/meteo_shortening_imgw.Rd

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

Loading

0 comments on commit 7f05f4f

Please sign in to comment.