R/importNmLstVector.R

Defines functions .importNmLstVector

#' Reads a "vector" stored in the text of a list file
#' @param text Vector of strings of text of a list file
#' @return A named numeric vector
#' @author Mango Solutions
#' @export
.importNmLstVector <- function(text)
{
	
	# 
	# Import a "vector" structure from the output file
	
	if( is.null(text)) return(NULL) 
	ltext <- length(text)
	if( (ltext  %% 2) != 0)
		RNMImportStop("text length is not divisible by two", call = match.call())
	
	varsIndex <- 1:(ltext/2)   # first half
	# extract the variable names
	vars <- .nmVariableNames( text[ varsIndex] )  
	values <- as.numeric( .readValues( text[-varsIndex] ) )
	names( values ) <- vars
	values
}

Try the RNMImport package in your browser

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

RNMImport documentation built on May 2, 2019, 5:21 p.m.