Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use rlib example actions #1

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/pkgdown.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
on:
push:
branches: master
branches:
- master

name: pkgdown

Expand Down
88 changes: 88 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
on:
push:
branches:
- master
- dev
pull_request:
branches:
- master
- dev

name: R-CMD-check

defaults:
run:
working-directory: dataCompareR

jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})

strategy:
fail-fast: false
matrix:
config:
- {os: windows-latest, r: 'release'}
- {os: macOS-latest, r: 'release'}
- {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
- {os: ubuntu-20.04, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
- {os: ubuntu-20.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest", http-user-agent: "R/4.1.0 (ubuntu-20.04) R (4.1.0 x86_64-pc-linux-gnu x86_64 linux-gnu) on GitHub Actions" }

env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RSPM: ${{ matrix.config.rspm }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v2

- uses: r-lib/actions/setup-r@v1
with:
r-version: ${{ matrix.config.r }}

- uses: r-lib/actions/setup-pandoc@v1

- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), "./depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), "./R-version")
shell: Rscript {0}

- name: Restore R package cache
uses: actions/cache@v2
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('./R-version') }}-1-${{ hashFiles('./depends.Rds') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('./R-version') }}-1-

- name: Install system dependencies
if: runner.os == 'Linux'
run: |
while read -r cmd
do
eval sudo $cmd
done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))')

- name: Install dependencies
run: |
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("rcmdcheck")
shell: Rscript {0}

- name: Check
env:
_R_CHECK_CRAN_INCOMING_REMOTE_: false
run: |
options(crayon.enabled = TRUE)
rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
shell: Rscript {0}

- name: Upload check results
if: failure()
uses: actions/upload-artifact@main
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
path: check
12 changes: 0 additions & 12 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions dataCompareR/R/cd_compareData.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
#' @param keys vector of chars - names of index variables
#' @param maxMismatches Integer. The max number of mismatches to assess, after which dataCompareR will stop
#' (without producing a dataCompareR object). Designed to improve performance for large datasets.
#' @return mismatchObject containing mismatch data for each of the variables in
#' the dataframes
#' @return mismatchObject containing mismatch data for each of the variables in the dataframes
#' @keywords internal
#'
#' @examples
#'\dontrun{compareData(iris, iris)}
Expand Down
3 changes: 3 additions & 0 deletions dataCompareR/R/cd_createMismatchObject.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#' @param str_index, vector of index variables (could have length 1)
#'
#' @return An dataCompareR mismatch object
#' @keywords internal
#'
#' @examples
#'\dontrun{createMismatchObject(dataA, dataB, mism, idx)}
Expand Down Expand Up @@ -70,6 +71,7 @@ createMismatchObject <- function(dat_a, dat_b, dat_eq, str_index) {
#' @param vector_eq, a list of columns which are equal
#'
#' @return Mismatch table
#' @keywords internal
#'
variableMismatches <- function(varname, vals_a, vals_b, vector_eq) {
d <- vals_a[!vector_eq, ]
Expand All @@ -88,6 +90,7 @@ variableMismatches <- function(varname, vals_a, vals_b, vector_eq) {
#' @param dat The mismatch data
#'
#' @return mismatch details
#' @keywords internal
variableDetails <- function(dat) {


Expand Down
3 changes: 3 additions & 0 deletions dataCompareR/R/cd_locateMismatches.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#'
#' @param x any object
#' @return a string listing the classes of x, seperated by commas
#' @keywords internal
#'
#' @examples
#'\dontrun{collapseClasses(iris)}
Expand All @@ -28,6 +29,7 @@ collapseClasses <- function(x) {
#' @param trueFalseMatrix a matrix of true/false
#' @param maxMismatches number of mismatches at which the routine stopes
#' @return Nothing. Stops if threshold exceeded
#' @keywords internal

mismatchHighStop <- function(trueFalseMatrix, maxMismatches) {
# If we already have too many mismatches, stop
Expand All @@ -51,6 +53,7 @@ mismatchHighStop <- function(trueFalseMatrix, maxMismatches) {
#' @importFrom dplyr mutate_all
#'
#' @return data frame containing keys and boolean logic of match/no match for each element
#' @keywords internal
#' If data types are not equal returns FALSE. Treats NA and NaN as unequal.
locateMismatches <- function(DFA, DFB, keys=NULL, maxMismatches=NA){

Expand Down
1 change: 1 addition & 0 deletions dataCompareR/R/out_createReportText.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#'
#' @param x input object which summary comparison information
#' @return text in R markdown format
#' @keywords internal
#' @examples
#'\dontrun{createReportText(x=MysummaryCompareObject)}
createReportText <- function(x){
Expand Down
1 change: 1 addition & 0 deletions dataCompareR/R/out_generateMismatchData.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#' @param ... Unused currently, may be used in future
#' @export
#' @return \code{mismatchData} A list containing two objects: mismatched rows in first data object and mismatched rows in
#' @keywords internal
#' second data object
#'
generateMismatchData <- function(x, dfA, dfB, ...){
Expand Down
2 changes: 2 additions & 0 deletions dataCompareR/R/out_helperFunctions.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#'
#' @param x an object
#' @return \code{boolean} is object null T/F
#' @keywords internal
#' @examples
#'\dontrun{isNotNull(NULL)}
#'\dontrun{isNotNull(5)}
Expand All @@ -24,6 +25,7 @@ isNotNull <- function(x) !is.null(x)
#'
#' @param headerName a header name
#' @return \code{character} a character based section headers
#' @keywords internal
outputSectionHeader <- function(headerName) {
newLine <- "\n"
decoration <- paste(rep("=", nchar(headerName)), collapse="")
Expand Down
3 changes: 3 additions & 0 deletions dataCompareR/R/out_outputStructureFunctions.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#' @param uniquevarlist A list of the variables in the compare
#' @param nObs How many obervations to return
#' @return A list of mismatching observations from start/end of mismatches
#' @keywords internal
listObsNotVerbose <- function(i, x, uniquevarlist, nObs) {
mismatchesHead <- head(x$mismatches[[uniquevarlist[i]]], nObs)
mismatchesTail <- tail(x$mismatches[[uniquevarlist[i]]], nObs)
Expand Down Expand Up @@ -48,6 +49,7 @@ listObsNotVerbose <- function(i, x, uniquevarlist, nObs) {
#' @param i The position of the element we want to compare
#' @param x An dataCompareR object
#' @return A list of mismatching observations
#' @keywords internal
listObsVerbose <- function(i, x) {
mismatches <- x$mismatches[[i]]
mismatches$rowNo <- as.numeric(rownames(mismatches))
Expand All @@ -64,6 +66,7 @@ listObsVerbose <- function(i, x) {
#'
#' @param x An dataCompareR object
#' @return A string containing the required message
#' @keywords internal
allVarMatchMessage <- function(x){
newLine <-"\n"
cat("All compared variables match", newLine,
Expand Down
2 changes: 2 additions & 0 deletions dataCompareR/R/out_rCompObjectQueryFunctions.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#'
#' @param x an object
#' @return length, numeric
#' @keywords internal
rcompObjItemLength <- function(x){
if (isNotNull(x)) {
if(is.data.frame(x)) {
Expand All @@ -35,6 +36,7 @@ rcompObjItemLength <- function(x){
#' @param x the column to be considered
#' @param mismatches - a mismatches object from an dataCompareR object
#' @return data frame with a summary of the mismatching column
#' @keywords internal
colsWithUnequalValues <- function(x, mismatches){
if (isNotNull(x)) {

Expand Down
1 change: 1 addition & 0 deletions dataCompareR/R/out_summaryrcompareobject.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#' @param mismatchCount Integer. How many mismatches to include in tables
#' @param ... Passes any additional arguments (not used in current version)
#' @return The function summary.dataCompareR computes and returns a list of summary details from the dataCompareR output given in \code{object} containing
#' @keywords internal
#' \item{datanameA}{name of the first dataframe in the compare call}
#' \item{datanameB}{name of the second dataframe in the compare call}
#' \item{nrowA}{the number of rows in \code{datanameA}}
Expand Down
1 change: 1 addition & 0 deletions dataCompareR/R/out_unifiedOutputGenerator.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#' @param x an dataCompareR object
#' @param ... Arguments passed on to other functions
#' @return cat's lines to the screen (or to be captured)
#' @keywords internal
createTextSummary <- function(x,...) {

dataCompHeader <- 'Data Comparison'
Expand Down
1 change: 1 addition & 0 deletions dataCompareR/R/pd_coerceFactorsToChar.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#'
#' @param DF Input dataframe
#' @return \code{DF} with factor fields converted to character type
#' @keywords internal
#' @examples
#' \dontrun{coerceFactorsToChar(iris)}

Expand Down
4 changes: 4 additions & 0 deletions dataCompareR/R/pd_executeCoercions.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,13 @@
#' @param DFB Input dataframe B
#' @param WhitespaceTrim User defined boolean for whether leading/trailing white space is trimmed in strings (TRUE / FALSE)
#' @return \code{out} list containing 3 data frames DFA, DFB and DataTypes
#' @keywords internal
#' @return \code{DFA} Dataframe with factor fields converted to character type and white space trimming (if option is selected by the user)
#' @keywords internal
#' @return \code{DFB} Dataframe with factor fields converted to character type and white space trimming (if option is selected by the user)
#' @keywords internal
#' @return \code{DataTypes} Dataframe with field types before and after cleaning for both DFA and DFB
#' @keywords internal
#' @examples
#' \dontrun{executeCoercions(DFA=iris,DFB=iris,WhitespaceTrim= TRUE)}

Expand Down
4 changes: 4 additions & 0 deletions dataCompareR/R/pd_matchColumns.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#' @param DFA input data frame
#' @param DFB input data frame
#' @return matchColOut named list of data frames. subsetA,subsetB contain only columns common to both data frames. colInfoA,colInfoB contain mapping of column names from original to treated and boolean indicator of common columns.
#' @keywords internal
#'
matchColumns <- function(DFA, DFB){

Expand All @@ -38,6 +39,7 @@ matchColumns <- function(DFA, DFB){
#' cleanColNames : get colnames, remove leading and trailing whitespace and push to upper case
#' @param DF Input dataframe
#' @return colInfo dataframe containing original and treated column names of DF
#' @keywords internal

cleanColNames <- function(DF) {

Expand All @@ -53,6 +55,7 @@ cleanColNames <- function(DF) {
#' orderColumns: order columns by treated column names
#' @param colInfo dataframe containing original and treated column names of DF
#' @return ordered colInfo dataframe containing original and treated column names of DF
#' @keywords internal
#'
orderColumns <- function(colInfo) {

Expand Down Expand Up @@ -84,6 +87,7 @@ compareNames <- function(colInfoA, colInfoB){
#' @param DFB input data frame
#' @param colInfoList named list containing the column mapping data frames and the list of common column names
#' @return matchColOut named list of data frames. subsetA,subsetB contain only columns common to both data frames. colInfoA,colInfoB contain mapping of column names from original to treated and boolean indicator of common columns.
#' @keywords internal

subsetDataColumns <- function(DFA, DFB, colInfoList){

Expand Down
6 changes: 6 additions & 0 deletions dataCompareR/R/pd_matchRows.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#' single character, or a vector of characters
#' @import stringi
#' @return A list containing the two dataframes, subsetted by shared indices, and a list which itself
#' @keywords internal
#' contains dataframes for the dropped rows
matchRows <- function(df_a, df_b, indices = NA)
{
Expand All @@ -41,6 +42,7 @@ matchRows <- function(df_a, df_b, indices = NA)
#'
#' @param df_indices A vector of values
#' @return Boolean - true if all values in vector are unique, false if not
#' @keywords internal
#' @examples
#' \dontrun{checkUniqueness(c('car','van','van'))}
#' \dontrun{checkUniqueness(c('car','van','bus'))}
Expand All @@ -59,6 +61,7 @@ checkUniqueness <- function(df_indices)
#' @param index_key A character array
#' @param df A data frame
#' @return A dataframe containing the dropped rows
#' @keywords internal
createAntiSubset <- function(index_antisubset,original_keys,index_key, df)
{
if(length(index_antisubset)==0){
Expand All @@ -83,6 +86,7 @@ createAntiSubset <- function(index_antisubset,original_keys,index_key, df)
#' @param index_key A character vector
#' @param original_keys A character vector
#' @return A list containing the two dataframes, subsetted by shared indices, and a list which itself
#' @keywords internal
#' contains the vectors for the dropped rows
#'
matchSingleIndex <- function(df_a, df_b, index_key, original_keys)
Expand Down Expand Up @@ -137,6 +141,7 @@ matchSingleIndex <- function(df_a, df_b, index_key, original_keys)
#' @param df_b A dataframe
#' @param indices A char vector
#' @return A list containing the two dataframes, subsetted by shared indices, and a list which itself
#' @keywords internal
#' contains the vectors for the dropped rows
matchMultiIndex <- function(df_a, df_b, indices)
{
Expand All @@ -157,6 +162,7 @@ matchMultiIndex <- function(df_a, df_b, indices)
#' @param df_a A dataframe
#' @param df_b A dataframe
#' @return A list containing the two dataframes, subsetted to the size of the smaller one, and
#' @keywords internal
#' a list containing vectors of the rows dropped.
matchNoIndex <- function(df_a, df_b)
{
Expand Down
1 change: 1 addition & 0 deletions dataCompareR/R/pd_prepareData.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#'
#' @inheritParams rCompare
#' @return \code{dataCompareRObject} containing details of the comparison
#' @keywords internal
#' @examples
#' \dontrun{dfA <- iris}
#' \dontrun{dfB <- iris}
Expand Down
1 change: 1 addition & 0 deletions dataCompareR/R/pd_trimCharVars.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#'
#' @param DF Input dataframe
#' @return \code{DF} with preceding and trailing white spaces removed from character fields
#' @keywords internal
#' @examples
#' \dontrun{trimCharVars(iris)}

Expand Down
1 change: 1 addition & 0 deletions dataCompareR/R/pf_createCompareObject.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#' Generates an empty list of the correct class to store results
#'
#' @return A list of class dataCompareRObject
#' @keywords internal
#'

createCompareObject <- function() {
Expand Down
1 change: 1 addition & 0 deletions dataCompareR/R/pf_processFlow.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#' @param roundDigits Integer. If NA, numerics are not rounded before comparison. If /code{roundDigits} is specified, numerics are
#' rounded to /code{roundDigits} decimal places using \link[base]{round}.
#' @return \code{dataCompareRObject} containing details of the comparison
#' @keywords internal

processFlow <- function(dfa, dfb, roundDigits, keys,mismatches, trimChars,argsIn) {

Expand Down
1 change: 1 addition & 0 deletions dataCompareR/R/rc_coerceData.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#' @param doa Data object A (any object that can be coerced to a data frame)
#' @param dob Data object B (any object that can be coerced to a data frame)
#' @return A list of 2 data frames, which is DOA and DOB coerced as data.frames
#' @keywords internal
#' @examples
#' \dontrun{irisMatrix <- as.matrix(iris)}
#' \dontrun{coerceData(irisMatrix,iris)}
Expand Down
Loading