ManageFarmers | R Documentation |
R6 class that takes a list with a vector of farmer names and a database connection object. Adds a unique ID field for each farmer that is used for internal relationships. If a farmer is already present in the database, it will be skipped. This follows the ManageDB interface and includes a setup and execute method that is called from the ManageDB class.
dbCon
Database connection object connected to an OFPE formatted database, see DBCon class.
farmers
Vector of farmer names to add to the database.
new()
Create an ManageFarmers object. The database connection and a vector of farmer names are used to upload farmer information to the database. Instantiates the class for running the setup and execute methods.
ManageFarmers$new(dbCon, action_item)
dbCon
Database connection object connected to an OFPE formatted database, see DBCon class.
action_item
List of inputs to the ManageFarmers method, from the list passed into the ManageDB class. This includes a vector of farmer names to add to the 'all_farms.farmers' table of an OFPE formatted database.
A new initialized 'ManageFarmers' object.
setup()
No setup needed for the ManageFarmers class. However is still present to abide by the ManageDB interface consisting of setup and execute methods.
ManageFarmers$setup()
execute()
Executes the upload of prepared farmer information to the database in the 'all_farms' schema and the 'farmers' table. If a farmer is already present with the same name and ID, it will be skipped.
ManageFarmers$execute()
None
No arguments needed because they are provided during class initialization.
Farmer data uploaded into 'all_farms.farmers' table in the database.
.uploadFarmers()
Uploads a farmer to the database. Takes the farmer name and adds it to the 'all_farms.farmers' table. Makes sure there is no conflict defined in the .buildTables method of the BuildDB class. A farmeridx is automatically generated upon upload by PostgreSQL. The dot indicates that this function would be private if not for documentations sake.
ManageFarmers$.uploadFarmers(farmer, db)
farmer
Name of a farmer for upload into 'all_farms.farmers'.
db
Database connection.
Farmer upload into database.
clone()
The objects of this class are cloneable with this method.
ManageFarmers$clone(deep = FALSE)
deep
Whether to make a deep clone.
DBCon
for database connection class,
ManageDB
for the class that calls this class to manage the database.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.