Skip to content

Commit

Permalink
rhub check
Browse files Browse the repository at this point in the history
SermetPekin committed Jan 13, 2025
1 parent 02c2a6a commit 6e36fce
Showing 17 changed files with 162 additions and 72 deletions.
4 changes: 4 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -14,3 +14,7 @@
^docs$
^pkgdown$
^revdep$
^Dockerfile$
^Main\.R
^docker-compose\.yaml
^UnnamedFileRapi\.xlsx$
95 changes: 95 additions & 0 deletions .github/workflows/rhub.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# R-hub's generic GitHub Actions workflow file. It's canonical location is at
# https://github.com/r-hub/actions/blob/v1/workflows/rhub.yaml
# You can update this file to a newer version using the rhub2 package:
#
# rhub::rhub_setup()
#
# It is unlikely that you need to modify this file manually.

name: R-hub
run-name: "${{ github.event.inputs.id }}: ${{ github.event.inputs.name || format('Manually run by {0}', github.triggering_actor) }}"

on:
workflow_dispatch:
inputs:
config:
description: 'A comma separated list of R-hub platforms to use.'
type: string
default: 'linux,windows,macos'
name:
description: 'Run name. You can leave this empty now.'
type: string
id:
description: 'Unique ID. You can leave this empty now.'
type: string

jobs:

setup:
runs-on: ubuntu-latest
outputs:
containers: ${{ steps.rhub-setup.outputs.containers }}
platforms: ${{ steps.rhub-setup.outputs.platforms }}

steps:
# NO NEED TO CHECKOUT HERE
- uses: r-hub/actions/setup@v1
with:
config: ${{ github.event.inputs.config }}
id: rhub-setup

linux-containers:
needs: setup
if: ${{ needs.setup.outputs.containers != '[]' }}
runs-on: ubuntu-latest
name: ${{ matrix.config.label }}
strategy:
fail-fast: false
matrix:
config: ${{ fromJson(needs.setup.outputs.containers) }}
container:
image: ${{ matrix.config.container }}

steps:
- uses: r-hub/actions/checkout@v1
- uses: r-hub/actions/platform-info@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}
- uses: r-hub/actions/setup-deps@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}
- uses: r-hub/actions/run-check@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}

other-platforms:
needs: setup
if: ${{ needs.setup.outputs.platforms != '[]' }}
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.label }}
strategy:
fail-fast: false
matrix:
config: ${{ fromJson(needs.setup.outputs.platforms) }}

steps:
- uses: r-hub/actions/checkout@v1
- uses: r-hub/actions/setup-r@v1
with:
job-config: ${{ matrix.config.job-config }}
token: ${{ secrets.RHUB_TOKEN }}
- uses: r-hub/actions/platform-info@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}
- uses: r-hub/actions/setup-deps@v1
with:
job-config: ${{ matrix.config.job-config }}
token: ${{ secrets.RHUB_TOKEN }}
- uses: r-hub/actions/run-check@v1
with:
job-config: ${{ matrix.config.job-config }}
token: ${{ secrets.RHUB_TOKEN }}
36 changes: 11 additions & 25 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
Package: Rapi
Type: Package
Title: Interface for Multiple Data Providers 'EDDS' and 'FRED'
Version: 1.0.5
Date: 2024-04-06
Title: Interface for Multiple Data Providers `EDDS` and `FRED`
Version: 1.0.6
Date: 2025-01-13
Authors@R: c(
person("Sermet", "Pekin", , "sermet.pekin@gmail.com", role = c("aut", "cre" , "cph"))
)
Maintainer: Sermet Pekin <sermet.pekin@gmail.com>
URL: https://github.com/DataRapi/Rapi, https://DataRapi.github.io/Rapi/
BugReports: https://github.com/DataRapi/Rapi/issues
Description: Interface for multiple data sources, such as the
'EDDS' API <https://evds2.tcmb.gov.tr/index.php?/evds/userDocs> of the
`EDDS` API <https://evds2.tcmb.gov.tr/index.php?/evds/userDocs> of the
Central Bank of the Republic of Türkiye and the
'FRED' API <https://fred.stlouisfed.org/docs/api/fred/> of the Federal Reserve Bank.
`FRED` API <https://fred.stlouisfed.org/docs/api/fred/> of the Federal Reserve Bank.
Both data providers require API keys for access, which users can easily obtain
by creating accounts on their respective websites.
The package provides caching ability with the selection of periods to increase the
@@ -26,26 +26,12 @@ LinkingTo: Rcpp
Depends:
R (>= 3.4.3),
Rcpp
Imports:
crayon,
digest,
dplyr,
httr,
httr2,
glue,
jsonlite,
lubridate,
magrittr,
purrr,
rlang,
rlist,
stringr,
tibble
Suggests:
writexl ,
devtools,
testthat
Imports: crayon, digest, dplyr,
httr, httr2, glue, jsonlite,
lubridate, magrittr, purrr, rlang,
rlist, stringr, tibble, writexl
Suggests: devtools, testthat
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.1
RoxygenNote: 7.3.2
Encoding: UTF-8
Config/testthat/edition: 3
6 changes: 5 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Rapi (development version)

# Rapi 1.0.6
* Better `set_api_key` function was implemented.
* moved `writexl` package from suggested to required.

# Rapi 1.0.5
* Moved key parameter to the header for the source `EVDS`.

@@ -8,4 +12,4 @@

# Rapi 1.0.3

* Initial CRAN submission. (previously named vyos)
* Initial CRAN submission. (previously named `vyos`)
14 changes: 7 additions & 7 deletions R/api_keys.R
Original file line number Diff line number Diff line change
@@ -142,14 +142,14 @@ show_usage <- function(func_name = "set_api_key",

#' set_api_key
#'
#' @param key api key of the source
#' @param source_name evds or fred
#' @param option choice of later usage. env or file should be given to
#' save api key for later use. Default is env which
#' saves api key as environment variable.
#' if `env` default value is selected it will save api key
#' @param key API key of the source
#' @param source_name `evds` or `fred`
#' @param option choice of later usage. `env` or file should be given to
#' save API key for later use. Default is env which
#' saves API key as environment variable.
#' if `env` default value is selected it will save API key
#' as an environment variable
#' if `file` was selected it will save api key to current folder.
#' if `file` was selected it will save API key to current folder.
#' @param ... for future versions
#' @return
#' The function has no return value.
4 changes: 2 additions & 2 deletions R/excel.R
Original file line number Diff line number Diff line change
@@ -2,14 +2,14 @@
#' Rapi_GETPREP object.
#' @description
#' The excel() function creates an excel file according to the object given.
#' data.frame or List of data frame or Rapi_GETPREP object can be passed..
#' `data.frame` or List of data frame or `Rapi_GETPREP` object can be passed..
#' @param dfs object or list of data frame to write
#' @param file_name file name to save
#' @param folder folder to save file
#' @param .debug for internal use
#' @param env environment
#' @param ... for future versions
#' @return it returns object or list of data frame back
#' @return it returns object or list of `dataframe` back
#' @export
#' @examples
#' \dontrun{
4 changes: 2 additions & 2 deletions R/get_series_export.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#' Requests data from multiple data sources.
#'
#' The `get_series()` function retrieves data from various sources, including the EDDS API and FRED API at this version.
#' The `get_series()` function retrieves data from various sources, including the `EDDS` API and `FRED` API at this version.
#' When multiple indexes are provided as a character vector or string template, the function individually
#' requests each item from the corresponding sources, discerning the source from the item's format.
#' The function combines data frames when there are common frequencies and returns both a combined data frame and
@@ -18,7 +18,7 @@
#' If verbose option is FALSE it gives a warning only if something goes wrong.
#' @param ... Additional parameters for future versions.
#' @param debug Debug option for development.
#' @param source Source such as "evds" or "fred" for internal use at this version.
#' @param source Source such as `evds` or `fred` for internal use at this version.
#' @param base Table or series on the source for internal use at this version.
#' @return An S3 object, Rapi_GETPREP, which has generic functions such as print and excel.
#' The `print` generic provides hints to the user on how to use requested data,
6 changes: 3 additions & 3 deletions R/lag_df.R
Original file line number Diff line number Diff line change
@@ -4,10 +4,10 @@
#' and lag sequences. This feature is beneficial for scenarios where you need
#' varying lag selections for certain columns, allowing flexibility in specifying
#' different lags for different columns or opting for no lag at all.
#' @param df A data.frame or tibble.
#' @param df A data.frame or `tibble`.
#' @param laglist A list of column names where each index corresponds to a column
#' name and the associated value is the lag sequence.
#' @return tibble
#' @return `tibble`
#' @export
#'
#' @examples
@@ -26,7 +26,7 @@ as_tibblex <- function(df) {
#' and lag sequences. This feature is beneficial for scenarios where you need
#' varying lag selections for certain columns, allowing flexibility in specifying
#' different lags for different columns or opting for no lag at all.
#' @param df A data.frame or tibble.
#' @param df A data.frame or `tibble`.
#' @param laglist A list of column names where each index corresponds to a column
#' name and the associated value is the lag sequence.
#' @return data.frame
12 changes: 6 additions & 6 deletions R/sp_df_utils.R
Original file line number Diff line number Diff line change
@@ -48,19 +48,19 @@ remove_column <- function(df, column_name) {
#' remove_na_safe
#' @description
#' This function removes rows from both ends of a data frame until it identifies
#' a row where all columns have non-NA values. Starting from the beginning, it
#' a row where all columns have `non-NA` values. Starting from the beginning, it
#' removes rows until it encounters a row with complete data at a specific row
#' index (e.g., row 5).
#' It then proceeds to remove rows from the end of the data frame, eliminating
#' any rows with at least one NA value in any column.
#' The process stops when it finds a row where all columns contain non-NA values,
#' any rows with at least one `NA` value in any column.
#' The process stops when it finds a row where all columns contain `non-NA` values,
#' and the resulting data frame is returned.
#'
#' @param df data.frame to remove na rows from the beginning and from the end
#' @param verbose give detailed info while removing NA values
#' @param df data.frame to remove `NA` rows from the beginning and from the end
#' @param verbose give detailed info while removing `NA` values
#'
#' @usage remove_na_safe(df , verbose = FALSE )
#' @return data.frame returns data.frame after removing rows if all columns are NA
#' @return data.frame returns data.frame after removing rows if all columns are `NA`
#' from the beginning and after
#' @export
#' @examples
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
## Overview

Rapi package is an interface to make requests from data providers.
Current version is able to connect to APIs of [EDDS](https://evds2.tcmb.gov.tr/index.php?/evds/userDocs/) of CBRT (Central Bank of the Republic of Türkiye)
Current version is able to connect to APIs of [`EDDS`](https://evds2.tcmb.gov.tr/index.php?/evds/userDocs/) of CBRT (Central Bank of the Republic of Türkiye)
and [FRED API](https://fred.stlouisfed.org/docs/api/fred/) of FED (Federal Reserve Bank).

## Installation
@@ -41,7 +41,7 @@ install_github("DataRapi/Rapi")


``` r
# Set API keys for EDDS
# Set API keys for `EDDS`
set_api_key("YOUR_EDDS_API_KEY", "evds", "env")
# Set API keys for FRED
set_api_key("YOUR_FRED_API_KEY", "fred", "env")
@@ -465,12 +465,12 @@ excel(obj, "file_name.xlsx", "somefolder")
```
## Getting API Keys

To access data from EDDS (CBRT) and FRED (FED), users need to obtain API keys by creating accounts on their respective websites.
To access data from `EDDS` (CBRT) and FRED (FED), users need to obtain API keys by creating accounts on their respective websites.

### EDDS (CBRT) API Key
### `EDDS` (CBRT) API Key

1. Visit the [EDDS (CBRT) API Documentation](https://evds2.tcmb.gov.tr/index.php?/evds/userDocs).
2. Create an account on the EDDS website if you don't have one.
1. Visit the [`EDDS` (CBRT) API Documentation](https://evds2.tcmb.gov.tr/index.php?/evds/userDocs).
2. Create an account on the `EDDS` website if you don't have one.
3. Follow the documentation to generate your API key.

### FRED (FED) API Key
1 change: 1 addition & 0 deletions Rsearch.Rproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Version: 1.0
ProjectId: 3ac5526f-0b5b-4729-b003-8189c4542aca

RestoreWorkspace: Default
SaveWorkspace: Default
4 changes: 2 additions & 2 deletions man/excel.Rd

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

4 changes: 2 additions & 2 deletions man/get_series.Rd

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

4 changes: 2 additions & 2 deletions man/lag_df.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/lag_df2.Rd

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

12 changes: 6 additions & 6 deletions man/remove_na_safe.Rd
14 changes: 7 additions & 7 deletions man/set_api_key.Rd

0 comments on commit 6e36fce

Please sign in to comment.