checkProtection {goCluster} | R Documentation

## A function to protect intermediate results from being overwritten

### Description

This function can be called by a method that will overwrite object data. `checkProtection` will retrieve the list in the `reset`-slot of the given object. The names of elements in this list will be considered as slot names and each list element will be compared against the value in the corresponding slot. If the length of any such pairs differs an error message will be issued.

### Usage

    checkProtection(object, method)

### Arguments

`object` | The object to check
`method` | A string that names the method trying to overwrite data. It will be included in the error message.

### Value

An error message in case the calling method would overwrite already calculated values.

### Author(s)

Gunnar Wrobel, work@gunnarwrobel.de, http://www.gunnarwrobel.de.

### See Also

`clusterModule-class`.

### Examples

    data(benomylsetupsmall)
    a <- new("goCluster")

    ## No error since the object has not been calculated yet
    checkProtection(a@algo,"test")

    execute(a) <- benomylsetupsmall

    ## This results in an error since the object contains calculated data
    error <- try(checkProtection(a@algo,"test"), silent = TRUE)
    error

    ## No error since no visualization method has been chosen
    checkProtection(a@visu,"test")

[Package goCluster version 1.4.0 Index]