Description Usage Arguments Value Author(s) Examples
View source: R/exportSpatialization.R
you can both store the encoded string in a variable and in a file by specifying write = TRUE
1 2 | exportSpatialization(spatialized, path = NULL, filename = NULL,
format = "csv")
|
spatialized |
a dataframe containing the gridded predicted values |
path |
a character specifying the path where you want your export file to be stored. Default = |
filename |
a character specifying the name you want to give to the file. If NULL the exportation is not printed into a file and the output is returned as a character. Default = NULL |
format |
a character specifying the type of export format. One of "csv", "json" or "geojson". Default = "csv" |
A 2 elements named list
snitch
: a boolean. Is TRUE
if function has provided the expected result. Is FALSE
is function throws an error
output
: a named list which elements are :
value
: a character vector containing the data encoded into the desired exportation format
condition
: a character specifying the condition encountered by the function : success, warning, or error.
message
: a character specifying the message relative to the condition.
A 2 elements named list : snitch
& output
.
snitch
is TRUE
if function has provided the expected result.
output
is a named list which contains :
value is a character vector containing the data encoded into the desired exportation format.
condition is a character specifying if the function has encountered success, warning, error.
message is the message relative to the condition.
Thomas Goossens
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | # load magrittr for pipe use : %>%
library(magrittr)
## Not run:
# create the dataset
myDataset = makeDataset(
dfrom = "2017-03-04T15:00:00Z",
dto = "2017-03-04T18:00:00Z",
sensor = "tsa")
# extract the list of hourly sets of records
myDataset = myDataset$output$value
# create the tasks
myTasks = purrr::map(myDataset, makeTask, target = "tsa")
# extract the tasks from the outputs
myTasks = myTasks %>% purrr::modify_depth(1, ~.$"output"$"value"$"task")
# keep the first task
myTask = myTasks[[1]]
# create the model
myModel = makeModel(
task = myTask,
learner = agrometeorLearners$mulLR_lonLatAlt_NA)
# extract the relevant information
myModel = myModel$output$value
# spatialize using the trained model
mySpatialization = makeSpatialization(
model = myModel$trained,
pred.grid = grid.df) # grid.df comes precompiled with the package
# get the relevant information
mySpatialization = mySpatialization$output$value
# export the spatialized data a json as a character returned into myJson variable
myJson = exportSpatialization(spatialized = mySpatialization$spatialized, format = "json")
# show th json string
myJson$output$value
# show myJson
myJson$output$value
# export as a csv file
exportSpatialization(spatialized = mySpatialization$spatialized, filename = "test", path = getwd(), format = "csv")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.