This package is made to add and remove data (and also with graphically interfaces) which is used for this package visualizer for freight agent-based models.
You can handle the data either directly in command-line(scripts) or in Map which we provided for this purpose.
By the end of this journey, you will have learnt how to make data file for the other sub-packages.
addAgent()
function make you able to add new agent to the map.
The parameters required for this function are:
agentName
The name of the agentagentShapeType
The type of agent's shape, could be circle, square, etc.agentType
Type of agent, in order to classifyingstartCoordinate
The coordinates of start-pointpath
The path of the start and end pointagentColor
The color which agent will be shown by in the mapdata
The data that contains the lines of filesIn this section, there are a few ways to remove an agent from the data list.
removeAgentByName()
will remove an agent from data
array by using the name of the agent.
agentName
The name of the agent to be removed
data
The data which contains line of the output
removeAgentByStartCoordinate()
will remove an agent by using the start point of the agent(s). The end point can be different in some decimal numbers. This means that using 53.23 will delete both 52.23 and 52.2342 but not 52.2
startCoordinate
The coordinate's of the location to start.
data
The data which contains line of the output
removeAgentByEndCoordinate()
will remove an agent by using the end point of the agent(s). The end point can be different in some decimal numbers. This means that using 53.23 will delete both 52.23 and 52.2342 but not 52.2
endCoordinate
The coordinate's of the location to start.
data
The data which contains line of the output
removeAgentByIndex()
will remove an agent by using the index of the line in data array.
index
The index of the line to delete
data
The data which contains line of the output
removeAgentByArray()
will remove a series of agents by their index. e.g. if you pass c(1,2,3,4) as indicesArray to this function, this will delete lines with indices of 1, 2, 3 and 4.
indicesArray
The index of the line to delete
data
The data which contains line of the output
This function provides a map(which actually is a leaflet map) to handle the data graphically.
To see the map enter openMap(data)
, the data changes by adding and modifying the details in opened map.
The parameters required for this function are:
* data
The array which contains the lines of information
The GIF below provides a little bit information about how it works. At the time you are installing this package, it may have changed in graphical interfaces but the main idea should be still the same.
You can load a data file from your local machine by just using readData
which only takes one parameter.
* path
The file path
This function returns the data has been saved into the file
After changing and add agents to a variable, let's name it data
, you can save the contents of this array of lines into a text file by using saveFile
function. This function gets two parameters:
path
The destination path file
data
The array of lines
First, you need to install devtools
package, (if you haven't done yet). You can do this with running:
install.packages("devtools")
Then, you should load the library to have access to its functions
library(devtools)
Finally, you can install any R package which served on the Github. For example, you can now install FABMDataHandler package with this line of code:
install_github("AmirHKiani98/FABM-DataHandler-R")
Hooray!
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.