HenrikBengtsson / future.tests

:nut_and_bolt: R package: future.tests - Test Suite for Future API Backends
https://future.tests.futureverse.org
10 stars 1 forks source link

ROBUSTNESS: Add explicit 'stringsAsFactors' arguments [cbind, rbind] #12

Closed HenrikBengtsson closed 4 years ago

HenrikBengtsson commented 4 years ago
$ for pkg in $pkgs; do echo "$pkg:"; (cd "$pkg"; grep -E "^[ \t]*[^#].*[cr]bind" -- */*.R | grep -vF stringsAsFactors;); echo; read -r -p "Press ENTER to continue ..."; done

future.tests:
R/Test-class.R:  df <- Reduce(rbind, df)
R/TestResult-class.R:  df <- Reduce(rbind, df)
tests/Test-class.R:df_tests <- do.call(rbind, tests)
tests/Test-class.R:df_results <- do.call(rbind, results)
tests/test_db.R:df_tests <- do.call(rbind, tests)
tests/test_db.R:df_tests <- do.call(rbind, tests_a)
tests/test_db.R:df_tests <- do.call(rbind, tests_b)
tests/test_db.R:df_tests <- do.call(rbind, tests_c)
HenrikBengtsson commented 4 years ago

Moot, because all these calls to rbind() take data.frame:s as input and then stringsAsFactors should not be applied, e.g.

> df <- data.frame(a=1:3, b=letters[1:3], stringsAsFactors=FALSE)

> str(df)
'data.frame':   3 obs. of  2 variables:
 $ a: int  1 2 3
 $ b: chr  "a" "b" "c"

> str(rbind(df, df))
'data.frame':   6 obs. of  2 variables:
 $ a: int  1 2 3 1 2 3
 $ b: chr  "a" "b" "c" "a" ...