ImportOF | R Documentation |
R6 class for for importing data collected on-farms data into an OFPE formatted database.
dbCon
Database connection object connected to an OFPE formatted database, see DBCon class.
dat_path
Path to the folder that contains the data for upload into the OFPE database.
file_names
Names of the files in the data folder.
status
Data frame with a status update on the completion of each file's data import.
farmers
The 'farmers' table from the 'all_farms' schema of an OFPE formatted database.
farms
The 'farms' table from the 'all_farms' schema of an OFPE formatted database.
fields
The 'fields' table from the 'all_farms' schema of an OFPE formatted database.
new()
Create a database importer object.
ImportOF$new(dbCon, dat_path)
dbCon
Database connection object connected to an OFPE formatted database, see DBCon class.
dat_path
Path to the folder that contains the data for upload into the OFPE database.
A new 'ImportOF' object.
executeUpload()
On-farm data import execution.
ImportOF$executeUpload()
None
No arguments needed because of class instantiation.
See 'status' object.
.uploadData()
Uploads data to an OFPE formatted database following a chain of methods and returning the status of the upload. The dot indicates that this function would be private if not for documentations sake.
ImportOF$.uploadData(name)
name
Name of the data file to upload to the database.
See 'status' object.
.impDat()
Imports data for uploading to an OFPE database. If data is a shapefile imported directly using 'sf' package, otherwise brings in data as .csv. The dot indicates that this function would be private if not for documentations sake.
ImportOF$.impDat(name)
name
Name of the data file to upload to the database.
Imported data.
.makeSptl()
Makes data that was imported for uploading into spatial data. This only applies to non-shapefiles, as they are already spatial. This is for the .csv protein or SSURGO data that is imported. The dot indicates that this function would be private if not for documentations sake.
ImportOF$.makeSptl(FILE, name)
FILE
The imported data from the .impDat method.
name
The filename for the data imported from the .impDat method.
Data in spatial format.
.oldDatClean()
Cleans up any column names that might mess with new ones that are created in the data workflow. This is mainly to prevent issues when using data from Phil's database. The dot indicates that this would be private if not for documentations sake.
ImportOF$.oldDatClean(FILE)
FILE
The imported data for upload.
Data without old columns.
.findInfo()
Identifies distinguishing features of the data, such as a field name if present, the corresponding farmer, and the year the data is collected. The dot indicates that this would be private if not for documentations sake.
ImportOF$.findInfo(FILE, name)
FILE
The imported data for upload.
name
The name of the file for upload.
Data without old columns.
.fixCols()
Goes through each file and replaces any column names with more palatable formats such as lower case and without any special characters. The dot indicates that this would be private if not for documentations sake.
ImportOF$.fixCols(FILE)
FILE
The imported data for upload.
Data with cleaned up column names.
.uploadFun()
Function for uploading each file to the appropriate section of the database. This function identifies the data type and uses the information identified in the data to organize and upload the data. The dot indicates that this would be private if not for documentations sake.
ImportOF$.uploadFun(FILE, name, db)
FILE
The imported data for upload.
name
The name of the file for upload.
db
Connection to an OFPE database.
Data uploaded to the database
clone()
The objects of this class are cloneable with this method.
ImportOF$clone(deep = FALSE)
deep
Whether to make a deep clone.
DBCon
for the database connection class, and
ImportGEE
for the associated Google Earth Engine data import
class in the data import step.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.