Home > Blockchain >  ggplot, dplyr etc in Windows without rlang.dll?
ggplot, dplyr etc in Windows without rlang.dll?

Time:02-11

In R for Windows and the tidyverse what does rlang.dll do and can I do without it if I install and load libraries such as dyplyr, magrittr and ggplot2 separately?

CodePudding user response:

The file rlang.dll is a binary file that contains compiled C code that rlang calls to do some of its work. Since {dplyr} and {ggplot2} both import functions from rlang, this makes rlang a hard dependency of both packages, meaning that these packages can't run without it. If you specifically try to install {ggplot2} and {dplyr} without their hard dependencies, they won't run.

As a concrete example, the first line of the source code for the data frame method of dplyr's mutate function contains this line:

  keep <- arg_match(.keep)

Where arg_match is imported from rlang. The source code for arg_match includes a call to the non-exported rlang function arg_match0, which you can see in the r console by doing:

rlang:::arg_match0
#> function (arg, values, arg_nm = as_label(substitute(arg))) 
#> {
#>     .External(rlang_ext_arg_match0, arg, values, environment())
#> }
#> <bytecode: 0x00000258f4d35bd0>
#> <environment: namespace:rlang>

This .External call indicates that the arguments are being passed to a compiled C function registered in rlang.dll.

So without the rlang dll, there is no arg_match0, so no arg_match, and therefore no mutate. It's difficult to imagine using {dplyr} without mutate. And of course, this is just one example.

  • Related