Attempts to execute the text in cmd. This is done in a try/catch environment to capture any errors.
Value
list with the following fields:
isgood: Boolean indicating the whether the evaluation was successful.
error: If the evaluation failed this contains the error object.
msgs: Character vector of messages and/or errors.
capture: List with names of objects to be captured and values corresponding to those captured objects.
Examples
# Successful command
res_good = FM_tc("good_cmd=ls()", list(), c("good_cmd"))
res_good
#> $capture
#> $capture$good_cmd
#> [1] "capture" "cmd"     "isgood"  "msgs"    "name"    "tc_env"  "tcres"  
#> 
#> 
#> $isgood
#> [1] TRUE
#> 
# Failed command
res_bad = FM_tc("bad_cmd =not_a_command()", list(), c("bad_cmd"))
res_bad
#> $error
#> <simpleError in not_a_command(): could not find function "not_a_command">
#> 
#> $isgood
#> [1] FALSE
#> 
#> $msgs
#> [1] "message: could not find function \"not_a_command\""
#> [2] "call:    not_a_command"                            
#> 
