EJAM/EJSCREEN comparisons - Convert output of ejscreenapi_plus to format of ejamit table of sites
Source:R/ejscreenit_for_ejam.R
ejscreenapi2ejam_format.Rd
Used by ejscreenit_for_ejam()
to make it easier to compare EJScreen and EJAM results
Usage
ejscreenapi2ejam_format(
ejscreenapi_plus_out,
fillmissingcolumns = FALSE,
ejamcolnames = NULL
)
Arguments
- ejscreenapi_plus_out
results of ejscreenapi_plus() or also could be results of ejscreenit()$table even though the colnames differ, because they get converted here in that case. Alternatively also can be the whole list output of ejscreenit() not just ejscreenit()$table, which this function will figure out.
- fillmissingcolumns
optional. set to TRUE if you want the output to have exactly all the same columns as the EJAM table would, and fill in with NA values all the columns not provided by EJScreen API.
- ejamcolnames
optional. if specified as vector of colnames, it overrides the assumed colnames that would have been taken to be colnames(testoutput_ejamit_10pts_1miles$results_bysite). Any colnames you specify here will be the colnames of the output if fillmissingcolumns = TRUE, or else those not in names(ejscreenapi_plus_out) will be omitted.
Value
A data.table not just data.frame, with some or all of the columns found in output of ejamit()$results_bysite
Examples
if (FALSE) { # \dontrun{
y1 <- ejscreenit_for_ejam(testpoints_10[1:2, ], radius = 1)
x <- ejscreenapi_plus(testpoints_10[1:2, ], radius = 1)
y <- ejscreenapi2ejam_format(x)
ejamvars <- names(testoutput_ejamit_10pts_1miles$results_bysite)
all.equal(
names(y),
ejamvars[ejamvars %in% names(y)]
)
z <- ejscreenapi2ejam_format(x, fillmissingcolumns = T)
all.equal(names(z), ejamvars)
# for convenience also can do this:
x <- ejscreenapi2ejam_format()
} # }