RNull
Details and Options
- RNull corresponds to the Wolfram Language's Null.
- Unless you manually construct or otherwise work with the RLink internal form of expressions representing R objects, you are unlikely to be using this head.
Examples
Basic Examples (1)
Needs["RLink`"]
InstallR[]The Wolfram Language's Null is interpreted as R NULL during conversion to RLink's internal representation:
ToRForm[Null]Of course, it also works in another direction:
FromRForm[RNull[]] // InputFormYou can set a variable (or part of an expression, e.g. part of a list) to NULL:
RSet["test", Null]Comparison to NULL does not really work—it returns a logical vector of length 0:
REvaluate["test == NULL"]You can, however, test the type of the value stored in the test variable:
REvaluate["typeof(test)"]The proper way to test for NULL is via the is.null built-in R function:
REvaluate["is.null(test)"]Vectors of zero length are also considered NULL in R:
REvaluate["is.null(c())"]For this reason, assigning NULL to a vector's element is an error:
REvaluate["myVec <- 1:10"]RSet["myVec[3]", Null]Assigning NULL to an element of a list is not an error, and effectively deletes that element from a list. Here is a test list:
RSet["myList", Range /@ Range[3]]This will assign NULL to its second element:
RSet["myList[2]", Null]This is equivalent to removal of that element from a list:
REvaluate["myList"]In some sense, R NULL therefore combines the behavior of the Wolfram Language's Null and Sequence[].
Tech Notes
Text
Wolfram Research (2012), RNull, Wolfram Language function, https://reference.wolfram.com/language/RLink/ref/RNull.html.
CMS
Wolfram Language. 2012. "RNull." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/RLink/ref/RNull.html.
APA
Wolfram Language. (2012). RNull. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/RLink/ref/RNull.html
BibTeX
@misc{reference.wolfram_2026_rnull, author="Wolfram Research", title="{RNull}", year="2012", howpublished="\url{https://reference.wolfram.com/language/RLink/ref/RNull.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_rnull, organization={Wolfram Research}, title={RNull}, year={2012}, url={https://reference.wolfram.com/language/RLink/ref/RNull.html}, note=[Accessed: 13-June-2026]}