CaseFileDelimiter {RNetica} | R Documentation |
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.
CaseFileDelimiter(newdelimiter = NULL, session=getDefaultSession()) CaseFileMissingCode(newcode = NULL, session=getDefaultSession())
newdelimiter |
A character scalar containing the new delimiter. It must be either a comma, a space, or a tab. |
session |
An object of type |
newcode |
The character to be used as a delimiter. It must be either an asterisk ("*"), a question mark ("?"), a space, (" ") or the empty string (""). |
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.
The value of the delimiter or missing code before the function call as a string.
The default R missing code "NA" does not work with Netica.
Russell G. Almond
http://norsys.com/onLineAPIManual/index.html: SetCaseFileDelimChar_ns(), SetMissingDataChar_ns()
WriteFindings
, WriteFindings
,
read.CaseFile
, CaseStream
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)