I want to test my function that returns data.table, but there are problems. If the function returns data.table, then I should compare the resulting data. table with what I created manually? Maybe there is some function that would compare the resulting data. table with what I created?
I used this technique:
z <- read.csv("C:/Users/dima-/Dropbox/table.csv",sep=";")
library(testthat)
test_that("data.table number", {
expect_that(dt,equals(data))
})
I have an example function that returns data.table and I want to compare it with my data. table, I'm trying to figure out how best to test the function
z = data.table()
db <- iris
data <- function(dt){
dt <- paste0(dt,"1")
return(dt)
}
z <- data.table(data(db))