dataCompareR icon indicating copy to clipboard operation
dataCompareR copied to clipboard

Inconsistent capitalization

Open robne1982 opened this issue 9 years ago • 2 comments

Running

rm(list=ls())

library(dataCompareR)


#dataCompare will match data frames (or any objects that can be coerced to data frames) - this is part of the package (uses as.data.frame)

#Lets use iris in the first example
head(iris)

#Create a new data frame to use in dataCompareR

#Make a copy of iris
iris2 <- iris

#Change it by first subsetting just to the first 140 rows:
iris2 <- iris[1:140,]

#then remove Petal.Width column
iris2$Petal.Width <- NULL

#and then change some values
iris2[1:10,1] <- iris2[1:10,1] + 1

#Comparison without a key:
#Rows are matched based on order: if the dataframes have different number of rows then rows will be dropped from the larger data frame
#This will be recorded in the output

#Run the comparison
compIris <- rCompare(iris,iris2)


summary(compIris)

Results in

Columns only in iris: Petal.Width  
Columns in both : PETAL.LENGTH, SEPAL.LENGTH, SEPAL.WIDTH, SPECIES 

We're kinda stuck with capitals as we have no easy way of recovering the original case, but the first row should be capitals too!

robne1982 avatar Nov 07 '17 14:11 robne1982

Hi rnobleeddy, I think I found an easy fix and put the solution in out_unifiedOutputGenerator.R. My fix is to capitalize the character vector that prints out the column names in summaryReport. The only issue is that the tests fail in testMakeValidNames because it checks for exact string matching, not equality without case. Do you have a suggestion for a better place to put the fix or change the tests up to accommodate the fix?

RjLi13 avatar Jul 13 '18 01:07 RjLi13

Sorry for the delay in responding - in this case, I think it's best to change the tests - this also captures testing that your change is working.

robne1982 avatar Jul 25 '18 19:07 robne1982