On 06/09/2010 1:00 AM, raje...@cse.iitm.ac.in wrote:
Hi,

I have a vector who contents should look like this,

"c" "d" NULL "e" "f" etc
or 4 5 6 NULL 7 8 9

how can I represent the null value?

As others have said, you probably want NA rather than NULL. If you really want NULL, then use a list (a generic vector). So

x <- list("c", "d", NULL, "e", "f")
y <- list(4,5,6,NULL, 7,8,9)

You need to be careful when setting values, because

y[[1]] <- NULL

will *remove* element 1, not set it to NULL.  To set it to NULL, use

y[1] <- list(NULL)

Duncan Murdoch

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to