Running ‘testthat.R’ [39s/44s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > if (requireNamespace("testthat", quietly = TRUE)){
  +     library(testthat)
  +     library(dataPreparation)
  +     test_check("dataPreparation")
  + }
  Loading required package: lubridate
  
  Attaching package: 'lubridate'
  
  The following object is masked from 'package:base':
  
      date
  
  Loading required package: stringr
  Loading required package: Matrix
  Loading required package: progress
  dataPreparation 0.4.2
  Type dataPrepNews() to see new features/changes/bug fixes.
  [1] "aggregateByKey: I start to aggregate"
  [1] "aggregateByKey: 6 columns have been constructed. It took 0.03 seconds. "
  [1] "findAndTransformDates: It took me 1.84s to identify formats"
  [1] "findAndTransformDates: It took me 0.31s to transform 4 columns to a Date format."
  [1] "findAndTransformDates: It took me 0s to identify formats"
  [1] "findAndTransformDates: There are no dates to transform. (If i missed something please provide the date format in inputs or consider using setColAsDate to transform it)."
  [1] "identifyDates: column date_col seems to have an ambiguity, I try to solve it."
  [1] "fastDiscretization: I will build splits for 1 numeric columns using, equal_width method."
  [1] "fastDiscretization: it took me: 0s to build splits for 1 numeric columns."
  [1] "fastDiscretization: I will build splits for 1 numeric columns using, equal_freq method."
  [1] "fastDiscretization: it took me: 0s to build splits for 1 numeric columns."
  [1] "fastDiscretization: I will build splits for 1 numeric columns using, equal_width method."
  [1] "fastDiscretization: it took me: 0s to build splits for 1 numeric columns."
  [1] "not_numeric_col"
  [1] "fastDiscretization: not_numeric_col aren't columns of types numeric i do nothing for those variables."
  [1] "fastDiscretization: I will build splits for 0 numeric columns using, equal_width method."
  [1] "fastDiscretization: it took me: 0s to build splits for 0 numeric columns."
  [1] "fastDiscretization: I will build splits for 1 numeric columns using, equal_width method."
  [1] "equal_width_splits: constant_col can't provide 10 equal width bins; instead you will have 0 bins."
  [1] "fastDiscretization: column constant_col seems to be constant, I do nothing."
  [1] "fastDiscretization: it took me: 0s to build splits for 0 numeric columns."
  [1] "equal_width_splits: dataSet can't provide 10 equal width bins; instead you will have 0 bins."
  [1] "equal_freq_splits: dataSet can't provide 10 equal freq bins; instead you will have 2 bins."
  [1] "fastDiscretization: I will build splits for 1 numeric columns using, equal_width method."
  [1] "fastDiscretization: it took me: 0s to build splits for 1 numeric columns."
  [1] "fastDiscretization: I will discretize 1 numeric columns using, bins."
  [1] "fastDiscretization: it took me: 0s to transform 1 numeric columns into, binarised columns."
  [1] "unFactor: I will identify variable that are factor but shouldn't be."
  [1] "unFactor: I unfactor false_factor."
  [1] "unFactor: It took me 0s to unfactor 1 column(s)."
  [1] "unFactor: I will identify variable that are factor but shouldn't be."
  [1] "unFactor: I unfactor true_factor."
  [1] "unFactor: I unfactor false_factor."
  [1] "unFactor: It took me 0s to unfactor 2 column(s)."
  [1] "fastFilterVariables: I check for constant columns."
  [1] "fastFilterVariables: I delete 1 constant column(s) in dataSet."
  [1] "fastFilterVariables: I check for columns in double."
  [1] "fastFilterVariables: I delete 1 column(s) that are in double in dataSet."
  [1] "fastFilterVariables: I check for columns that are bijections of another column."
  [1] "fastFilterVariables: I delete 1 column(s) that are bijections of another column in dataSet."
  [1] "fastFilterVariables: I check for columns that are included in another column."
  [1] "fastFilterVariables: I delete 3 column(s) that are bijections of another column in dataSet."
  [1] "generateFromCharacter: it took me: 0s to transform 1 character columns into, 3 new columns."
  [1] "generateFromCharacter: it took me: 0.09s to transform 3 character columns into, 9 new columns."
  [1] "generateFactorFromDate: I will create a factor column from each date column."
  [1] "generateFactorFromDate: It took me 0s to transform 1 column(s)."
  [1] "generateDateDiffs: I will generate difference between dates."
  [1] "generateDateDiffs: It took me 0s to create 3 column(s)."
  [1] "generateFromFactor: it took me: 0.2s to transform 10 factor columns into, 30 new columns."
  [1] "generateFromFactor: it took me: 0.01s to transform 4 factor columns into, 12 new columns."
  [1] "one_hot_encoder: Since you didn't profvide encoding, I compute them with build_encoding."
  [1] "build_encoding: I will compute encoding on 1 character and factor columns."
  [1] "build_encoding: it took me: 0s to compute encoding for 1 character and factor columns."
  [1] "one_hot_encoder: I will one hot encode some columns."
  [1] "one_hot_encoder: I am doing column: character_col"
  [1] "one_hot_encoder: It took me 0s to transform 1 column(s)."
  [1] "build_encoding: I will compute encoding on 1 character and factor columns."
  [1] "build_encoding: it took me: 0s to compute encoding for 1 character and factor columns."
  [1] "build_encoding: I will compute encoding on 1 character and factor columns."
  [1] "build_encoding: it took me: 0.03s to compute encoding for 1 character and factor columns."
  [1] "build_target_encoding: Start to compute encoding for target_encoding according to col: grades."
  [1] "target_encode: Start to encode columns according to target."
  [1] "build_target_encoding: Start to compute encoding for target_encoding according to col: grades."
  [1] "target_encode: Start to encode columns according to target."
  [1] "build_target_encoding: Start to compute encoding for target_encoding according to col: target."
  [1] "build_target_encoding: Start to compute encoding for target_encoding according to col: target."
  [1] "build_target_encoding: Start to compute encoding for target_encoding according to col: target."
  [1] "col_2"
  [1] "real_cols: col_2 aren't columns of the table, i do nothing for those variables"
  [1] "date_col"
  [1] "real_cols: date_col aren't columns of types numeric i do nothing for those variables."
  [1] "id"
  [1] "real_cols: id aren't columns of types date i do nothing for those variables."
  [1] "findAndTransformNumerics: It took me 0s to identify 2 numerics column(s), i will set them as numerics"
  [1] "setColAsNumeric: I will set some columns as numeric"
  [1] "setColAsNumeric: I am doing the column col1."
  [1] "setColAsNumeric: 0 NA have been created due to transformation to numeric."
  [1] "setColAsNumeric: I will set some columns as numeric"
  [1] "setColAsNumeric: I am doing the column col2."
  [1] "setColAsNumeric: 0 NA have been created due to transformation to numeric."
  [1] "findAndTransformNumerics: It took me 0s to transform 2 column(s) to a numeric format."
  [1] "findAndTransformNumerics: It took me 0s to identify 0 numerics column(s), i will set them as numerics"
  [1] "findAndTransformNumerics: There are no numerics to transform.(If i missed something consider using setColAsNumeric to transform it)"
  V 0.4.2
  =======
  - Fix test :
    - Case in "build_encoding: min_frequency allows to drop rare values" was not built correctly.
    
  V 0.4.1
  =======
  - New features:
    - New functions:
      - Functions *target_encode* and *build_target_encoding* have been implemented to provide target encoding which is the process of replacing a categorical value with the aggregation of the target variable.
      - Function *remove_sd_outlier* helps to remove rows that have numerical values to extrem.
      - Function *remove_percentile_outlier* helps to remove rows that have numerical values to extrem (based on percentile analysis).
      - Function *remove_rare_categorical* helps to remove rows that have categorial values to rare.
    - New features in existing functions : 
      - Function *prepareSet* integrate *target_encode* function. It is called by providing *target_col* and *target_encoding_functions*.
  
  V 0.4.0
  =======
  - New features:
    - New features in existing functions : 
      - To avoid issues based on column names, we will check and rename columns that have same names. 
      - In *aggregateByKey* generated column names are changed to be more explicit. 
      - In *aggregateByKey* generated from character column with more than \code{thresh} values is now count of unique instead of count.
      - Added missing *auto* default values on cols
  
  - Bug fixes:
    - *whichAreBijection* and *whichAreInDouble* are using *bi_col_test* which was not working with 2 column data set. It is fixed.
    - *prepareSet* optinal argumennt *factor_date_type* was not working. It is fixed.
  
  - Other changes: 
    - Changed *whichAreIncluded* example since it was to slow for CRAN. Also it might be a little bit more explicit now.
    - Changed *aggregateByKey* example since it was to slow for CRAN.
  
  - Integration:
    - Rewrite all tests to make them more readable
    - Code coverage is improved, depencies on *messy_adult* set is lowered
  
  WARNING:
  - In *aggregateByKey* generated column names are changed.
  - In *aggregateByKey* generated column for character is different.
  
  V 0.3.9
  =======
  - Integration:
    	- Matching new devtools requierments
    	- Starting to rewrite unittest to make it more readable
  
  V 0.3.8
  =======
  - New features:
    	- New features in existing functions:
  		- Identification of bijection through internal function *fastIsBijection* is way faster (up to 40 times faster in case of bijection). So *whichArebijection* and *fastFiltervariables* are also improved.
  		- Remove remaining *gc* to save time. 
  		- In *one_hot_encoder* added parameter *type* to make choise between logical or numerical results.
  	  
    	  
  V 0.3.7
  =======
  - New features:
  	- New functions:
  		- Function *as.POSIXct_fast* is now available. It helps to transform to POSIXct way faster (if the same date value is present multiple times in the column).
  	- New features in existing functions:
  		- In dates identifications, we make it faster by computing search of format only on unique values.
  		- In date transformation, we made it faster by using *as.POSIXct_fast* when it is necessary.
  		- Functions *findAndTransFormDates*, *findAndTransformNumerics* and *unFactor* now accept argument *cols* to limitate search.
  
  - Bug fixes:
  	- Control that over-allocate option is activated on every data.table to avoid issues with set. Package should be more robust.
  	- In bijection search (internal function *fastIsBijection*) there was a bug on some rare cases. Fixed but slower.
  
  -Code quality:
  	- Improving code quality using lintr
  	- Suppressing some useless code
  	- Meeting new covr standard
  	- Improve log of setColAsXXX
  
  V 0.3.6
  =======
  - Bug fixes:
  	- *identifyDates* had a weird bug. Solved
  	
  - Integration:
  	- Making dataPreparation compatible with testthat 2.0.0
  	
  V 0.3.5
  =======
  - New features:
  	- New features in existing functions:
  		- *findAndTransFormDates* now as an *ambiguities* parameter, IGNORE to work as before, WARN to check for ambiguities and print them, SOLVE to try to solve ambiguities on more lines.
  		- *one_hot_encoder* now uses a *build_encoding* functions to be able to build same encoding on train and on test.
  		- *aggregateByKey* is now way faster on numerics. But it changed the way it gets input functions.
  		- *fastScale* now as a *way* parameter which allow you to either scale or unscale. Unscaling numeric values can be very usefull for most post-model analysis.
  		- *setColAsDate* now accept multiple formats in a single call.
  	- New functions:
  		- *build_encoding* build a list of encoding to be used by *one_hot_encoder*, it also has a parameter *min_frequency* to control that rare values doesn't result in new columns.
  		- Previously private function *identifyDates* is now exported. To be able to perform same transformation on train and on test.
  		- Adding *dataPrepNews* function to open NEWS file (inspired from rfNews() of randomForest package)
  		
  - Bug fixes:
  	- *findAndTransFormDates*: bug fixed: user formats weren't used.
  	- *identifyDates*: some formats where tested but would never work. They have been removed.
  	
  - Refactoring: 
  	- Unit test partly reviewed to be more readable and more efficient. Unit test time as been divided by 3.
  	- Improving input control for more robust functions
  	
  WARNING:
  - *one_hot_encoder* now requires you to run *build_encoding* first.
  - *aggregateByKey* now require functions to be passed by character name
  		
  This version is making (as much as possible) transformation reproducible on train and test set. This is to prepare future pipeline feature.
  
  V 0.3.4
  ========
  - Improvement of function 
  	- *whichAreBijection*: It is 2 to 15 time faster than previous version.
  	- *whichAreIncluded*: It is a bit faster.
  - Bug fixes:
  	- *generateFactorFromDate*: default value was missing. Fixed.
  - New features:
  	- New features in existing functions:
  		- *fastFilterVariables* has a new parameter (level) to choose which types of filtering to perform
  		
  WARNING:
  - *whichAreIncluded*: in case of bijection (col1 is a bijection of col2), they are both included in the other, but the choice of the one to drop might have changed in this version.
  
  V 0.3.3
  ========
  - New features:
  	- New features in existing functions:
  		- *findAndTransFormDates* now recognize date character even if there are multiple separator in date (ex: "2016, Jan-26").
  		- *findAndTransFormDates* now recognize date character even if there are leading and tailing white spaces.
  		
  WARNING:
  - *date3* column in *messy_adult* data set has changed in order to illustrate the recognition of date character even if there are leading and/or trailing white spaces.
  - *date4* column in *messy_adult* data set has changed in order to illustrate the recognition of date character even if there are multiple separator.
  
  V 0.3.2
  ========
  - Change URLs to meet CRAN requirement
  
  v 0.3.1
  =======
  - Fix bug in Latex documentation
  
  v 0.3
  =====
  - New features:
  	- New features in existing functions:
  		- *findAndTransFormDates* now recognize date character even if "0" are not present in month or day part and month as lower strings.
  		- *findAndTransFormDates* and *setColAsDate* now work with *factors*.
  	- New functions:
  		- *fastDiscretization*: to perform equal freq or equal width discretization on a data set using *data.table* power.
  		- *fastScale*: to perform scaling on a data set using *data.table* power.
  		- *one_hot_encoder*: to perform one_hot encoding on a data set using *data.table* power.
  	- New documentation:
  		- A new vignette to illustrate how to build a correct *train* and *test* set unising data preparation
  - Minor changes in log (in particular regarding progress bars and typos)
  	- Due to dependencies issues with *tcltk*, we stop using it and start using *progress*
  - Refactoring: 
  	- Private function *real_cols* take more importance to control that columns have the correct types and handling "auto" value.
  	- Making code faster: some functions are up to **30% faster**
  	- Review unit testing to be faster
  	- Unit test evolution to be more readable
  
  WARNING:
  - *date1* column in *messy_adult* data set has changed in order to illustrate the recognition of date character even if "0" are not present in month or day part.
  
  
  v 0.2
  =====
  - Improving unit testing and code coverage
  - Improving documentation
  - Solving minor bug in date conversion and in which functions
  - New features: 
  	- New functions:
  		- *unFactor* to unfactor columns, when reading wasn't performed in expected way.
  		- *sameShape* to make ure that train and test set have exactly the same shape.
  		- generate new columns from existing columns (generate functions)
  			- generate factor from dates: *generateFactorFromDate*
  			- diffDates becomes *generateDateDiffs* (for better name understanding).
  			- generate numerics and booleans from character of fators (using *generateFromFactor* and *generateFromCharacter*)
  			
  		- *setColAsFactor* a function to make multiple columns as factor and controling number of unique elements
  		
  	- New features in existing functions:	
  		- which functions: add *keep_cols* argument to make sure that they are not dropped
  		- fastFilterVariables: *verbose* can be T/F or 0, 1, 2 in order to control level of verbosity
  		- *findAndTransFormDates* and *setColAsDates* now recognize and accept timestamp.
  
  WARNING:
  - If you were using *diffDates*, it is now called *generateDateDiffs*
  - *date2* column in *messy_adult* data set have changed in order to illustrate new timestamp features
  - *setColAsFactorOrLogical* doesn't exist anymore: it as been splitted between *setColAsFactor* and *generateFromCat*
  - Considering all those changes: *shapeSet* and *prepareSet* don't give the same result anymore.
  
  
  v 0.1: release on CRAN July 2017
  ================================
  [1] "prepareSet: step one: correcting mistakes."
  [1] "fastFilterVariables: I check for constant columns."
  [1] "fastFilterVariables: I check for columns in double."
  [1] "fastFilterVariables: I check for columns that are bijections of another column."
  [1] "fastFilterVariables: I delete 1 column(s) that are bijections of another column in dataSet."
  [1] "unFactor: I will identify variable that are factor but shouldn't be."
  [1] "unFactor: I unfactor education."
  [1] "unFactor: I unfactor occupation."
  [1] "unFactor: I unfactor country."
  [1] "unFactor: It took me 0.02s to unfactor 3 column(s)."
  [1] "findAndTransformNumerics: It took me 0s to identify 0 numerics column(s), i will set them as numerics"
  [1] "findAndTransformNumerics: There are no numerics to transform.(If i missed something consider using setColAsNumeric to transform it)"
  [1] "findAndTransformDates: It took me 0.55s to identify formats"
  [1] "findAndTransformDates: There are no dates to transform. (If i missed something please provide the date format in inputs or consider using setColAsDate to transform it)."
  [1] "prepareSet: step two: transforming dataSet."
  [1] "generateDateDiffs: I will generate difference between dates."
  [1] "generateDateDiffs: It took me 0s to create 0 column(s)."
  [1] "generateFactorFromDate: I will create a factor column from each date column."
  [1] "generateFactorFromDate: It took me 0s to transform 0 column(s)."
  [1] "generateFromCharacter: it took me: 0.54s to transform 2 character columns into, 6 new columns."
  [1] "build_target_encoding: Start to compute encoding for target_encoding according to col: capital_gain."
  [1] "target_encode: Start to encode columns according to target."
  [1] "aggregateByKey: I start to aggregate"
  [1] "aggregateByKey: 63 columns have been constructed. It took 4.8 seconds. "
  [1] "prepareSet: step three: filtering dataSet."
  [1] "fastFilterVariables: I check for constant columns."
  [1] "fastFilterVariables: I delete 2 constant column(s) in result."
  [1] "fastFilterVariables: I check for columns in double."
  [1] "fastFilterVariables: I check for columns that are bijections of another column."
  [1] "fastFilterVariables: I delete 6 column(s) that are bijections of another column in result."
  [1] "prepareSet: step four: handling NA."
  [1] "prepareSet: step five: shaping result."
  [1] "setColAsFactor: I will set some columns to factor."
  [1] "setColAsFactor: I am doing the column country."
  [1] "setColAsFactor: it took me: 0s to transform 0 column(s) to factor."
  [1] "shapeSet: Transforming numerical variables into factors when length(unique(col)) <= 10."
  [1] "setColAsFactor: mean.age has more than 10 values, i don't transform it."
  [1] "setColAsFactor: max.age has more than 10 values, i don't transform it."
  [1] "setColAsFactor: mean.hr_per_week has more than 10 values, i don't transform it."
  [1] "setColAsFactor: max.hr_per_week has more than 10 values, i don't transform it."
  [1] "setColAsFactor: mean.education.num has more than 10 values, i don't transform it."
  [1] "setColAsFactor: max.education.num has more than 10 values, i don't transform it."
  [1] "setColAsFactor: mean.education.order has more than 10 values, i don't transform it."
  [1] "setColAsFactor: mean.occupation.num has more than 10 values, i don't transform it."
  [1] "setColAsFactor: mean.occupation.order has more than 10 values, i don't transform it."
  [1] "setColAsFactor: mean.capital_gain_mean_by_type_employer has more than 10 values, i don't transform it."
  [1] "setColAsFactor: mean.capital_gain_mean_by_marital has more than 10 values, i don't transform it."
  [1] "setColAsFactor: mean.capital_gain_mean_by_relationship has more than 10 values, i don't transform it."
  [1] "shapeSet: Previous distribution of column types:"
  col_class_init
  character   numeric 
          1        54 
  [1] "shapeSet: Current distribution of column types:"
  col_class_end
   factor numeric 
       43      12 
  [1] "remove_sd_outlier: I start to filter categorical rare events"
  [1] "remove_sd_outlier: dropped 1 row(s) that are rare event on num_col."
  [1] "remove_sd_outlier: 1 have been dropped. It took 0 seconds. "
  [1] "remove_sd_outlier: I start to filter categorical rare events"
  [1] "remove_sd_outlier: dropped 0 row(s) that are rare event on num_col."
  [1] "remove_sd_outlier: 0 have been dropped. It took 0.01 seconds. "
  [1] "remove_rare_categorical: I start to filter categorical rare events"
  [1] "remove_rare_categorical: dropped 1 row(s) that are rare event on cat_col."
  [1] "remove_rare_categorical: 1 have been dropped. It took 0.05 seconds. "
  [1] "remove_percentile_outlier: I start to filter categorical rare events"
  [1] "remove_percentile_outlier: dropped 2 row(s) that are rare event on num_col."
  [1] "remove_percentile_outlier: 2 have been dropped. It took 0.02 seconds. "
  [1] "remove_percentile_outlier: I start to filter categorical rare events"
  [1] "remove_percentile_outlier: dropped 2 row(s) that are rare event on num_col."
  [1] "remove_percentile_outlier: 2 have been dropped. It took 0 seconds. "
  [1] "sameShape: verify that every column is present."
  [1] "sameShape: columns col_2 are missing, I create them."
  [1] "sameShape: drop unwanted columns."
  [1] "sameShape: verify that every column is in the right type."
  [1] "sameShape: col_2 class was logical i set it to numeric."
  [1] "sameShape: verify that every factor as the right number of levels."
  [1] "sameShape: verify that every column is present."
  [1] "sameShape: drop unwanted columns."
  [1] "sameShape: the folowing columns are in dataSet but not in referenceSet: I drop them: "
  [1] "col_2"
  [1] "sameShape: verify that every column is in the right type."
  [1] "sameShape: verify that every factor as the right number of levels."
  [1] "sameShape: verify that every column is present."
  [1] "sameShape: drop unwanted columns."
  [1] "sameShape: verify that every column is in the right type."
  [1] "sameShape: col_1 class was character i set it to numeric."
  [1] "sameShape: verify that every factor as the right number of levels."
  [1] "sameShape: verify that every column is present."
  [1] "sameShape: drop unwanted columns."
  [1] "sameShape: verify that every column is in the right type."
  [1] "sameShape: col_1 class was character i set it to c(\"POSIXct\", \"POSIXt\")."
  [1] "sameShape: verify that every factor as the right number of levels."
  [1] "sameShape: verify that every column is present."
  [1] "sameShape: drop unwanted columns."
  [1] "sameShape: verify that every column is in the right type."
  [1] "sameShape: verify that every factor as the right number of levels."
  [1] "sameShape: col_1 class had different levels than in referenceSet I change it."
  [1] "sameShape: verify that every column is present."
  [1] "sameShape: drop unwanted columns."
  [1] "sameShape: verify that every column is in the right type."
  [1] "sameShape: verify that every factor as the right number of levels."
  [1] "sameShape: col_1 class had different levels than in referenceSet I change it."
  [1] "sameShape: verify that every column is present."
  [1] "sameShape: drop unwanted columns."
  [1] "sameShape: verify that every column is in the right type."
  [1] "sameShape: verify that every factor as the right number of levels."
  [1] "sameShape: verify that every column is present."
  [1] "sameShape: drop unwanted columns."
  [1] "sameShape: verify that every column is in the right type."
  [1] "sameShape: col_1 class was numeric i set it to weirdClass."
  [1] "sameShape: verify that every factor as the right number of levels."
  [1] "sameShape: verify that every column is present."
  [1] "sameShape: drop unwanted columns."
  [1] "sameShape: verify that every column is in the right type."
  [1] "sameShape: col_1 class was numeric i set it to weirdClass."
  [1] "sameShape: verify that every factor as the right number of levels."
  [1] "setColAsFactor: age has more than 10 values, i don't transform it."
  [1] "setColAsFactor: fnlwgt has more than 10 values, i don't transform it."
  [1] "setColAsFactor: education_num has more than 10 values, i don't transform it."
  [1] "setColAsFactor: capital_gain has more than 10 values, i don't transform it."
  [1] "setColAsFactor: hr_per_week has more than 10 values, i don't transform it."
  [1] "sameShape: verify that every column is present."
  [1] "sameShape: columns type_employer?, type_employerFederal-gov, type_employerLocal-gov, type_employerNever-worked, type_employerPrivate, type_employerSelf-emp-inc, type_employerSelf-emp-not-inc, type_employerState-gov, type_employerWithout-pay, education11th, education12th, education1st-4th, education5th-6th, education7th-8th, education9th, educationAssoc-acdm, educationAssoc-voc, educationBachelors, educationDoctorate, educationHS-grad, educationMasters, educationPreschool, educationProf-school, educationSome-college, maritalMarried-AF-spouse, maritalMarried-civ-spouse, maritalMarried-spouse-absent, maritalNever-married, maritalSeparated, maritalWidowed, occupationAdm-clerical, occupationArmed-Forces, occupationCraft-repair, occupationExec-managerial, occupationFarming-fishing, occupationHandlers-cleaners, occupationMachine-op-inspct, occupationOther-service, occupationPriv-house-serv, occupationProf-specialty, occupationProtective-serv, occupationSales, occupationTech-support, occupationTransport-moving, relationshipNot-in-family, relationshipOther-relative, relationshipOwn-child, relationshipUnmarried, relationshipWife, raceAsian-Pac-Islander, raceBlack, raceOther, raceWhite, sexMale, capital_loss1408, capital_loss1564, capital_loss1573, capital_loss1719, capital_loss1762, capital_loss1887, capital_loss1902, capital_loss2042, capital_loss2179, countryCambodia, countryCanada, countryChina, countryColumbia, countryCuba, countryDominican-Republic, countryEcuador, countryEl-Salvador, countryEngland, countryFrance, countryGermany, countryGreece, countryGuatemala, countryHaiti, countryHoland-Netherlands, countryHonduras, countryHong, countryHungary, countryIndia, countryIran, countryIreland, countryItaly, countryJamaica, countryJapan, countryLaos, countryMexico, countryNicaragua, countryOutlying-US(Guam-USVI-etc), countryPeru, countryPhilippines, countryPoland, countryPortugal, countryPuerto-Rico, countryScotland, countrySouth, countryTaiwan, countryThailand, countryTrinadad&Tobago, countryUnited-States, countryVietnam, countryYugoslavia, income>50K are missing, I create them."
  [1] "sameShape: drop unwanted columns."
  [1] "sameShape: the folowing columns are in dataSet but not in referenceSet: I drop them: "
   [1] "type_employer" "education"     "marital"       "occupation"   
   [5] "relationship"  "race"          "sex"           "capital_loss" 
   [9] "country"       "income"       
  [1] "sameShape: verify that every column is in the right type."
  [1] "sameShape: age class was integer i set it to numeric."
  [1] "sameShape: fnlwgt class was integer i set it to numeric."
  [1] "sameShape: education_num class was integer i set it to numeric."
  [1] "sameShape: capital_gain class was integer i set it to numeric."
  [1] "sameShape: hr_per_week class was integer i set it to numeric."
  [1] "sameShape: type_employer? class was logical i set it to numeric."
  [1] "sameShape: type_employerFederal-gov class was logical i set it to numeric."
  [1] "sameShape: type_employerLocal-gov class was logical i set it to numeric."
  [1] "sameShape: type_employerNever-worked class was logical i set it to numeric."
  [1] "sameShape: type_employerPrivate class was logical i set it to numeric."
  [1] "sameShape: type_employerSelf-emp-inc class was logical i set it to numeric."
  [1] "sameShape: type_employerSelf-emp-not-inc class was logical i set it to numeric."
  [1] "sameShape: type_employerState-gov class was logical i set it to numeric."
  [1] "sameShape: type_employerWithout-pay class was logical i set it to numeric."
  [1] "sameShape: education11th class was logical i set it to numeric."
  [1] "sameShape: education12th class was logical i set it to numeric."
  [1] "sameShape: education1st-4th class was logical i set it to numeric."
  [1] "sameShape: education5th-6th class was logical i set it to numeric."
  [1] "sameShape: education7th-8th class was logical i set it to numeric."
  [1] "sameShape: education9th class was logical i set it to numeric."
  [1] "sameShape: educationAssoc-acdm class was logical i set it to numeric."
  [1] "sameShape: educationAssoc-voc class was logical i set it to numeric."
  [1] "sameShape: educationBachelors class was logical i set it to numeric."
  [1] "sameShape: educationDoctorate class was logical i set it to numeric."
  [1] "sameShape: educationHS-grad class was logical i set it to numeric."
  [1] "sameShape: educationMasters class was logical i set it to numeric."
  [1] "sameShape: educationPreschool class was logical i set it to numeric."
  [1] "sameShape: educationProf-school class was logical i set it to numeric."
  [1] "sameShape: educationSome-college class was logical i set it to numeric."
  [1] "sameShape: maritalMarried-AF-spouse class was logical i set it to numeric."
  [1] "sameShape: maritalMarried-civ-spouse class was logical i set it to numeric."
  [1] "sameShape: maritalMarried-spouse-absent class was logical i set it to numeric."
  [1] "sameShape: maritalNever-married class was logical i set it to numeric."
  [1] "sameShape: maritalSeparated class was logical i set it to numeric."
  [1] "sameShape: maritalWidowed class was logical i set it to numeric."
  [1] "sameShape: occupationAdm-clerical class was logical i set it to numeric."
  [1] "sameShape: occupationArmed-Forces class was logical i set it to numeric."
  [1] "sameShape: occupationCraft-repair class was logical i set it to numeric."
  [1] "sameShape: occupationExec-managerial class was logical i set it to numeric."
  [1] "sameShape: occupationFarming-fishing class was logical i set it to numeric."
  [1] "sameShape: occupationHandlers-cleaners class was logical i set it to numeric."
  [1] "sameShape: occupationMachine-op-inspct class was logical i set it to numeric."
  [1] "sameShape: occupationOther-service class was logical i set it to numeric."
  [1] "sameShape: occupationPriv-house-serv class was logical i set it to numeric."
  [1] "sameShape: occupationProf-specialty class was logical i set it to numeric."
  [1] "sameShape: occupationProtective-serv class was logical i set it to numeric."
  [1] "sameShape: occupationSales class was logical i set it to numeric."
  [1] "sameShape: occupationTech-support class was logical i set it to numeric."
  [1] "sameShape: occupationTransport-moving class was logical i set it to numeric."
  [1] "sameShape: relationshipNot-in-family class was logical i set it to numeric."
  [1] "sameShape: relationshipOther-relative class was logical i set it to numeric."
  [1] "sameShape: relationshipOwn-child class was logical i set it to numeric."
  [1] "sameShape: relationshipUnmarried class was logical i set it to numeric."
  [1] "sameShape: relationshipWife class was logical i set it to numeric."
  [1] "sameShape: raceAsian-Pac-Islander class was logical i set it to numeric."
  [1] "sameShape: raceBlack class was logical i set it to numeric."
  [1] "sameShape: raceOther class was logical i set it to numeric."
  [1] "sameShape: raceWhite class was logical i set it to numeric."
  [1] "sameShape: sexMale class was logical i set it to numeric."
  [1] "sameShape: capital_loss1408 class was logical i set it to numeric."
  [1] "sameShape: capital_loss1564 class was logical i set it to numeric."
  [1] "sameShape: capital_loss1573 class was logical i set it to numeric."
  [1] "sameShape: capital_loss1719 class was logical i set it to numeric."
  [1] "sameShape: capital_loss1762 class was logical i set it to numeric."
  [1] "sameShape: capital_loss1887 class was logical i set it to numeric."
  [1] "sameShape: capital_loss1902 class was logical i set it to numeric."
  [1] "sameShape: capital_loss2042 class was logical i set it to numeric."
  [1] "sameShape: capital_loss2179 class was logical i set it to numeric."
  [1] "sameShape: countryCambodia class was logical i set it to numeric."
  [1] "sameShape: countryCanada class was logical i set it to numeric."
  [1] "sameShape: countryChina class was logical i set it to numeric."
  [1] "sameShape: countryColumbia class was logical i set it to numeric."
  [1] "sameShape: countryCuba class was logical i set it to numeric."
  [1] "sameShape: countryDominican-Republic class was logical i set it to numeric."
  [1] "sameShape: countryEcuador class was logical i set it to numeric."
  [1] "sameShape: countryEl-Salvador class was logical i set it to numeric."
  [1] "sameShape: countryEngland class was logical i set it to numeric."
  [1] "sameShape: countryFrance class was logical i set it to numeric."
  [1] "sameShape: countryGermany class was logical i set it to numeric."
  [1] "sameShape: countryGreece class was logical i set it to numeric."
  [1] "sameShape: countryGuatemala class was logical i set it to numeric."
  [1] "sameShape: countryHaiti class was logical i set it to numeric."
  [1] "sameShape: countryHoland-Netherlands class was logical i set it to numeric."
  [1] "sameShape: countryHonduras class was logical i set it to numeric."
  [1] "sameShape: countryHong class was logical i set it to numeric."
  [1] "sameShape: countryHungary class was logical i set it to numeric."
  [1] "sameShape: countryIndia class was logical i set it to numeric."
  [1] "sameShape: countryIran class was logical i set it to numeric."
  [1] "sameShape: countryIreland class was logical i set it to numeric."
  [1] "sameShape: countryItaly class was logical i set it to numeric."
  [1] "sameShape: countryJamaica class was logical i set it to numeric."
  [1] "sameShape: countryJapan class was logical i set it to numeric."
  [1] "sameShape: countryLaos class was logical i set it to numeric."
  [1] "sameShape: countryMexico class was logical i set it to numeric."
  [1] "sameShape: countryNicaragua class was logical i set it to numeric."
  [1] "sameShape: countryOutlying-US(Guam-USVI-etc) class was logical i set it to numeric."
  [1] "sameShape: countryPeru class was logical i set it to numeric."
  [1] "sameShape: countryPhilippines class was logical i set it to numeric."
  [1] "sameShape: countryPoland class was logical i set it to numeric."
  [1] "sameShape: countryPortugal class was logical i set it to numeric."
  [1] "sameShape: countryPuerto-Rico class was logical i set it to numeric."
  [1] "sameShape: countryScotland class was logical i set it to numeric."
  [1] "sameShape: countrySouth class was logical i set it to numeric."
  [1] "sameShape: countryTaiwan class was logical i set it to numeric."
  [1] "sameShape: countryThailand class was logical i set it to numeric."
  [1] "sameShape: countryTrinadad&Tobago class was logical i set it to numeric."
  [1] "sameShape: countryUnited-States class was logical i set it to numeric."
  [1] "sameShape: countryVietnam class was logical i set it to numeric."
  [1] "sameShape: countryYugoslavia class was logical i set it to numeric."
  [1] "sameShape: income>50K class was logical i set it to numeric."
  [1] "sameShape: verify that every factor as the right number of levels."
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  dataPreparation
   --- call from context --- 
  sameShape(adult, adult_num, verbose = verbose)
   --- call from argument --- 
  if (referenceSet_class == "data.frame") {
      setDF(dataSet)
  }
   --- R stacktrace ---
  where 1 at testthat/test_sameShape.R#143: sameShape(adult, adult_num, verbose = verbose)
  where 2: eval(code, test_env)
  where 3: eval(code, test_env)
  where 4: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 5: doTryCatch(return(expr), name, parentenv, handler)
  where 6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 7: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 10: tryCatchList(expr, classes, parentenv, handlers)
  where 11: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 12: test_code(desc, code, env = parent.frame())
  where 13 at testthat/test_sameShape.R#133: test_that("sameShape: transform shape into numerical matrix", 
      {
          data("adult")
          adult <- adult[1:150, ]
          adult2 <- copy(adult)
          setDT(adult2)
          adult_num <- shapeSet(adult2, finalForm = "numerical_matrix", 
              verbose = FALSE)
          adult_reshaped <- sameShape(adult, adult_num, verbose = verbose)
          expect_true(is.matrix(adult_reshaped))
      })
  where 14: eval(code, test_env)
  where 15: eval(code, test_env)
  where 16: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 17: doTryCatch(return(expr), name, parentenv, handler)
  where 18: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 19: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 20: doTryCatch(return(expr), name, parentenv, handler)
  where 21: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 22: tryCatchList(expr, classes, parentenv, handlers)
  where 23: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 24: test_code(NULL, exprs, env)
  where 25: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 26: force(code)
  where 27: doWithOneRestart(return(expr), restart)
  where 28: withOneRestart(expr, restarts[[1L]])
  where 29: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 30: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 31: FUN(X[[i]], ...)
  where 32: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 33: force(code)
  where 34: doWithOneRestart(return(expr), restart)
  where 35: withOneRestart(expr, restarts[[1L]])
  where 36: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 37: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 38: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 39: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 40: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 41: test_check("dataPreparation")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (dataSet, referenceSet, verbose = TRUE) 
  {
      function_name <- "sameShape"
      dataSet <- checkAndReturnDataTable(dataSet)
      is.verbose(verbose)
      referenceSet_class <- class(referenceSet)
      referenceSet <- checkAndReturnDataTable(referenceSet, name = "referenceSet")
      if (verbose) {
          printl(function_name, ": verify that every column is present.")
      }
      create_list <- names(referenceSet)[!names(referenceSet) %in% 
          names(dataSet)]
      if (length(create_list) > 0) {
          if (verbose) {
              printl(function_name, ": columns ", paste(create_list, 
                  collapse = ", "), " are missing, I create them.")
          }
          set(dataSet, NULL, create_list, NA)
      }
      if (verbose) {
          printl(function_name, ": drop unwanted columns.")
      }
      drop_list <- names(dataSet)[!names(dataSet) %in% names(referenceSet)]
      if (length(drop_list) > 0) {
          if (verbose) {
              printl(function_name, ": the folowing columns are in dataSet but not in referenceSet: I drop them: ")
              print(drop_list)
          }
          set(dataSet, NULL, drop_list, NULL)
      }
      if (verbose) {
          printl(function_name, ": verify that every column is in the right type.")
          pb <- initPB(function_name, names(dataSet))
      }
      for (col in names(dataSet)) {
          trans_class <- class(dataSet[[col]])
          ref_class <- class(referenceSet[[col]])
          if (!all(trans_class == ref_class)) {
              transfo_function <- paste0("as.", ref_class[[1]])
              if (exists(transfo_function)) {
                  if (verbose) {
                    printl(function_name, ": ", col, " class was ", 
                      trans_class, " i set it to ", ref_class, 
                      ".")
                  }
                  set(dataSet, NULL, col, get(transfo_function)(dataSet[[col]]))
                  if (!all(class(dataSet[[col]]) == ref_class)) {
                    warning(paste0(function_name, ": transformation didn't work. Please control that function ", 
                      transfo_function, " indeed transform into ", 
                      ref_class, "."))
                  }
              }
              else {
                  warning(paste0(function_name, ": ", col, " class is ", 
                    trans_class, " but should be ", ref_class, 
                    " and i don't know how to transform it."))
              }
          }
          if (verbose) {
              setPB(pb, col)
          }
      }
      gc(verbose = FALSE)
      if (verbose) {
          printl(function_name, ": verify that every factor as the right number of levels.")
          pb <- initPB(function_name, names(dataSet))
      }
      for (col in names(dataSet)) {
          if (is.factor(dataSet[[col]])) {
              transfo_levels <- levels(dataSet[[col]])
              ref_levels <- levels(referenceSet[[col]])
              if (!identical(transfo_levels, ref_levels)) {
                  set(dataSet, NULL, col, factor(dataSet[[col]], 
                    levels = ref_levels))
                  if (verbose) {
                    printl(function_name, ": ", col, " class had different levels than in referenceSet I change it.")
                  }
              }
          }
          if (verbose) {
              setPB(pb, col)
          }
      }
      gc(verbose = FALSE)
      setcolorder(dataSet, names(referenceSet))
      if (!identical(referenceSet_class, class(dataSet))) {
          if (referenceSet_class == "data.frame") {
              setDF(dataSet)
          }
          if (referenceSet_class == "matrix") {
              dataSet <- as.matrix(dataSet)
          }
      }
      return(dataSet)
  }
  <bytecode: 0x560c5b96bce0>
  <environment: namespace:dataPreparation>
   --- function search by body ---
  Function sameShape in namespace dataPreparation has this body.
   ----------- END OF FAILURE REPORT -------------- 
  Fatal error: the condition has length > 1