Displaying 2 results from an estimated 2 matches for "setnull".
Did you mean:
enull
2008 Feb 12
4
assigning NULLs to elements of a list
...I would prefer
R were doing, but both R examples do remove the element 'b':
x = list(a=c(1L,2L), b=matrix(runif(4),2,2), c=LETTERS[1:3])
library(inline)
code="
SEXP res;
PROTECT(res = Rf_duplicate(x));
SET_VECTOR_ELT(res,1,R_NilValue);
UNPROTECT(1);
return res;
"
setnull = cfunction(signature(x="list"),code)
setnull(x)
# $a
# [1] 1 2
# $b
# NULL
# $c
# [1] "A" "B" "C"
y = x
x[[2]] = NULL
x
# $a
# [1] 1 2
# $c
# [1] "A" "B" "C"
x = y
x$b = NULL
x
# $a
# [1] 1 2
# $c
# [1] "A" "B&...
2007 Jan 04
7
Hi: New SUNWqemu cvs20070102tue in the works .... rgds. -Martin
²Š'