# Create temporary filename
tmpcsv <- tempfile(fileext="csv")
# Generate test data
ntest <- 10
column_types <- c("integer", "integer", "double", "string")
testdata <- data.frame(
a = 1:ntest,
b = sample(1:2, ntest, replace=TRUE),
c = round(runif(ntest), 13),
d = sample(c("jan", "pier", "tjores", "corneel"), ntest, replace=TRUE),
stringsAsFactors = FALSE
)
# Write test data to csv file
write.table(testdata, file=tmpcsv, row.names=FALSE, col.names=TRUE, sep=',')
# Detect data model
model <- detect_dm_csv(tmpcsv, header=TRUE)
# Create LaF-object
laf <- laf_open(model)
# Cleanup
file.remove(tmpcsv)
Run the code above in your browser using DataLab