CaseFileDelimiter {RNetica}R Documentation

Gets or sets special characters for case files.

Description

The function CaseFileDelimiter sets the field delimiter used when writing case files. The function CaseFileMissingCode sets the character code used for missing values in case files. If called with a null argument, then the current value is returned.

Usage

CaseFileDelimiter(newdelimiter = NULL, session=getDefaultSession())
CaseFileMissingCode(newcode = NULL, session=getDefaultSession())

Arguments

newdelimiter

A character scalar containing the new delimiter. It must be either a comma, a space, or a tab.

session

An object of type NeticaSession which defines the reference to the Netica workspace.

newcode

The character to be used as a delimiter. It must be either an asterisk ("*"), a question mark ("?"), a space, (" ") or the empty string ("").

Details

Case files are essentially a comma separated value files, although tab and space are allowed as alternative delimiters. The space and empty string are only allowed as missing value codes when the delimiter is a comma.

The value of the delimiter is global, and applies to all case files written from this point on.

When the argument is null (the default) the current value is returned without changing it.

Value

The value of the delimiter or missing code before the function call as a string.

Note

The default R missing code "NA" does not work with Netica.

Author(s)

Russell G. Almond

References

http://norsys.com/onLineAPIManual/index.html: SetCaseFileDelimChar_ns(), SetMissingDataChar_ns()

See Also

WriteFindings, WriteFindings, read.CaseFile, CaseStream

Examples

sess <- NeticaSession()
startSession(sess)

defaultDelim <- CaseFileDelimiter(session=sess) # Get default
d1 <- CaseFileDelimiter("\t", session=sess)
d2 <- CaseFileDelimiter(" ", session=sess)
d3 <- CaseFileDelimiter(",", session=sess)

defaultMiss <- CaseFileMissingCode(session=sess) # Get default
m1 <- CaseFileMissingCode("*", session=sess)
m2 <- CaseFileMissingCode("?", session=sess)
m3 <- CaseFileMissingCode(" ", session=sess)
m4 <- CaseFileMissingCode("", session=sess)
## Not run: 
 ## This should throw an error.
 CaseFileDelimiter(" ", session=sess)

## End(Not run)

m5 <- CaseFileMissingCode("?", session=sess)

d4<- CaseFileDelimiter(" ", session=sess)
## Not run: 
  ## This should throw an error
  CaseFileMissingCode(" ", session=sess)

## End(Not run)
## But this is okay
CaseFileMissingCode("*", session=sess)

stopifnot(d1==defaultDelim, d2=="\t", d3==" ", d4==",")
stopifnot(m1==defaultMiss, m2=="*", m3=="?", m4==" ", m5=="")

## restore defaults
CaseFileDelimiter(defaultDelim, session=sess)
CaseFileMissingCode(defaultMiss, session=sess)

stopSession(sess)
  

[Package RNetica version 0.7-2 Index]