Skip to content
Prev 8008 / 12125 Next

[R-pkg-devel] Rlang and Code Evalutation Within Aesthetics

Good day,

I am troubled understanding why the following example doesn't work:
$x
`Classifier Name`
Error in `rlang::sym()`:
! Can't convert NULL to a symbol.
10. rlang::sym(characteristicsList[["fillColour"]])

but the following does work without error:
NULL # It is desirably avoiding the else part.

The first example seems to be evaluating the else part, even though the if condition is true.

The overall aim is to allow the end-user to specify a named list of appearance-modifying parameters, and for the function to create a ggplot with them, without being bamboozled if the end-user's list doesn't contain the specification for fill colour variable name or line colour variable name (like the list in the example above does not have). Thanks in advance for any suggested reading.

--------------------------------------
Dario Strbenac
University of Sydney
Camperdown NSW 2050
Australia