R/sv.R

sv <- function(the.vect, rownum=1){ #select variable
	#avoid going beyond the vector.
	#If we have only one entry, we may
	# assume that this is valid for all
	if(length(the.vect)==1) rownum=1

	stopifnot(is.null(the.vect) || rownum <= length(the.vect))

	if(is.null(the.vect)){
		to.ret <- "NULL" 
	} else if(is.na(the.vect[rownum])){
		to.ret <- "NULL" 
	} else {
		to.ret <- the.vect[rownum]
	}
	return(to.ret)
}

Try the RObsDat package in your browser

Any scripts or data that you put into this service are public.

RObsDat documentation built on May 2, 2019, 5:55 p.m.