karthik / testdat

A package to run unit tests on tabular data
142 stars 20 forks source link

UTF-8 checks #8

Closed karthik closed 10 years ago

karthik commented 10 years ago

ok gang (@hilaryparker) the UTF-8 check now works. See example at bottom of the script.

karthik commented 10 years ago

This would be now easy to use with testthat

library(testthat)
# Test
# Set the working directory to the package root
 data <- read.csv("local/km1314-waypoints.csv")
 expect_false(test_utf8(data))
>  expect_false(test_utf8(data))
Error: test_utf8(data) isn't false

With a verbose option

> expect_false(test_utf8(data, verbose = TRUE))
Now checking 3 columns...
UTF-8 characters detected in columns 
2 3
Error: test_utf8(data, verbose = TRUE) isn't false
Arrrr>