writeHRJAccessDatabase: (HRJ) Write HRJ "B" & "C" tables to MS Access database.

Description Usage Arguments Value Examples

Description

The Access data base must already be created, but can be empty. If there are tables with the same names as the data frames, then they will be over-written.

Usage

1
2
writeHRJAccessDatabase(hrj, extraTables = list(readme =
  data.frame(creationDate = format(Sys.Date(), "%d-%b-%Y"))), filename)

Arguments

hrj

A list usually comprising of two data frames, which are the 'b' and 'c' HRJ tables in wide format with fields exactly matching those defined in the MS Access data base.

extraTables

A list comprising of one or more named elements that must all be data frames. Each data frame will be written to a table that has the same name as the data frame (MS Access can't have periods in table names). If the list argument is not supplied, only a readme table is created with the creation date in its contents.

filename

A character string of length one. The MS Access filename.

Value

A MS database is written. Nothing is returned to R.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
hrj.list <- readHRJtext(filepath)
hrj.list$hrj.cwt.list <- lapply(hrj.list$hrj.cwt.list,updateStockByName, data.stock$stocks.df)
writeHRJAccessDatabase(hrj = hrj.list$hrj.cwt.list, filename = 'test.accdb')

#to add the "workingdata" table (which has C data, updated with B data):
hrj.list.long <- reshapeHRJtolong(hrj.list$hrj.cwt.list, data.stock)
workdingdata.wide <- reshapeHRJtowide(hrj.list.long$workingdata)
extraTables = list(stocks=data.stock$stocks.df, readme=data.frame(comment="this is a comment"))
#be sure to create the empty data base before next line:
writeHRJAccessDatabase(hrj = list(workingdata= workdingdata.wide), filename = 'test.accdb', extraTables=extraTables)

## End(Not run)

MichaelFolkes/ctctools documentation built on May 7, 2019, 4:56 p.m.