Functions for interacting with MFE database.
To use any of these scripts in your own analysis script, you'll need to:
-
Download the manual and/or sensor database from the Box directory. The manual database is also available on FigShare and DataONE. The sensor database may end up there soon too.
-
Install the library RSQLite:
install.packages("RSQLite")
(do this once, not at the top of every script). Then, at the top of each script, load the library:library(RSQLite)
. -
Set the variable
dbdir
to a string that contains the path to the database file on your computer. -
Set the variable
db
to the name of the database file on your computer (we don't recommend changing this from the name of the file you downloaded)
#let R find the MFE database files by setting the path
#******************************************************
dbdir <- file.path("C:/Users/ksaunde1/Documents/Regular Database/Current Database/")
db <- "MFEdb.db"
sensor_dbdir <- file.path"C:/Users/ksaunde1/Documents/Sensor Database/Current Database/")
sensor_db <- "MFEsensordb.db"
- Source the script name.
dbUtil.R contains 3 functions:
dbTableList()
which provides a list of tables in the manual databasedbTable()
which will return data from a table in the manual databasedbTableStructure()
which will return information about a table in the manual database
sensordbTable.R contains 2 functions:
sensordbTableList()
which returns a list of tables in the sensor databasesensordbTable()
which returns data from a table in the sensor database