alexsanjoseph / compareDF

R Tool to compare two data.frames
Other
93 stars 17 forks source link

fix for column name with punctuation character #38

Closed lcougnaud closed 3 years ago

lcougnaud commented 3 years ago

If the columns of the input dataset(s) contain unexpected characters, e.g. punctuation signs, the column names are modified to syntactically valid names in R. For example:

data <- beaver1
colnames(data)[which(colnames(data) == "temp")] <- "body temperature (Celsius)"
data_new <- head(data, 5)
data_old <- head(data, 6)
library(compareDF)
dataComp <- compare_df(data_new, data_old)
dataComp$comparison_df
#  rowname chng_type day time body.temperature..Celsius. activ
# 1       6         - 346  930                      36.69     0

The names are modified when the data is converted to data.frame. By default, the data.frame function converts column names to a valid syntax in R (check.names = TRUE by default). This pull requests ensure that even columns with out valid syntax are retained.

alexsanjoseph commented 3 years ago

Existing tests are failing - Can you take a pass and make sure the tests are passing? @lcougnaud

lcougnaud commented 3 years ago

Sorry I was not able to reproduce the tests that failed locally.

alexsanjoseph commented 3 years ago

No problem - Will take a look and add in a bit

alexsanjoseph commented 3 years ago

Superseded by https://github.com/alexsanjoseph/compareDF/pull/41