context('test offender')
library(fbicrime)
df_national <- summarize_offender(offense = 'burglary', variable = 'age')
df_nonnational <- summarize_offender(offense = 'arson', level = 'states', level_detail = 'NH', variable = 'sex')
test_that('data dimensions correct', {
expect_equal(ncol(df_national), 5)
expect_equal(ncol(df_nonnational), 6)
})
test_that('no missing values', {
expect_identical(df_national, na.omit(df_national))
expect_identical(df_nonnational, na.omit(df_nonnational))
})
test_that('data types correct', {
expect_is(df_national,'data.frame')
expect_is(df_nonnational,'data.frame')
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.