Description Usage Arguments Details Value Author(s) Examples
Reads readTable and writes replicated and equally distributed values into writeTable.
1 | expandTable(dbfile, tables, boundCols, indexCol, copyCols, expandCols, verbose=FALSE)
|
dbfile |
character. Name of database file. |
tables |
character. Name of read table and write table. |
boundCols |
character. Name of boundary columns: loBound and hiBound |
indexCol |
character. Name of index column which is written to output table. |
copyCols |
character. Name of columns which are copied. |
expandCols |
character. Name of columns which are expanded. |
verbose |
numeric. Verbosity of printed output. |
The function expands 'indexCol' value for values between first and second boundCols value.
Integer. Number of rows inserted into output table.
Wolfgang Kaisers
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | n <- 5
v <- 1:n
dfr <- data.frame(id=v,
exp1 = v * 100/7,
exp2 = v * 200/7,
cpy1 = letters[v],
cpy2 = 2*v,
min_woche = v*100 - 1,
max_woche = v*100 + 1)
dbfile <- file.path(".", "test.db3")
tables <- c("tbl", "rtbl")
boundCols <- c("min_woche", "max_woche")
indexCol <- "woche"
copyCols <- c("cpy1", "cpy2")
expandCols <- c("exp1", "exp2")
verbose <- 1L
# Write SQLite database. Contains test data
con <- dbConnect(RSQLite::SQLite(), dbfile)
dbWriteTable(con, tables[1], dfr, overwrite=TRUE)
dbDisconnect(con)
# Do replicate
nr <- expandTable(dbfile, tables, boundCols, indexCol, copyCols, expandCols, verbose)
nr
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.