R/hashmap.R

Defines functions SetHash GetHash .KillHash GetHashNames GetHashList

Documented in GetHash GetHashList GetHashNames SetHash

# Functions to create and delete the local hashmap


SetHash <- function(name, data, ...){
	if(!is.list(RStorm.env$RStormData$hash)){
		RStorm.env$RStormData$hash <- list()
	}
  	RStorm.env$RStormData$hash[[name]] <- data
	TRUE
}

GetHash <- function(name, object=NULL){
	if(is.RStorm(object)){
		return(object$data[[name]])
	} else {
  		return(RStorm.env$RStormData$hash[[name]])
	}
}

.KillHash <- function(){
	RStorm.env$RStormData$hash <- NULL
}

GetHashNames <- function(object){
	if(!is.RStorm(object)){
		stop("Please provide an RStorm result object.")
	}
	print(names(object$data))
}

GetHashList <- function(object=NULL){
	if(is.RStorm(object)){
		return(object$data)
	} else {
  		return(RStorm.env$RStormData$hash)
	}
}

Try the RStorm package in your browser

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

RStorm documentation built on May 2, 2019, 9:14 a.m.