Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Library: xplore
See also: readm readcsvm readascii read write writecsv

Quantlet: writem
Description: writes numerical and text data to a text file

Usage: writem(data,filename{,separator,dfmt,tfmt})
Input:
data data to write; they can be a numerical matrix, a text matrix or a list containing numerical and text vectors and matrices having all the same number of rows
filename string, contains the name of the file
separator optional string, contains the data separator sign (default is tabulator, which is used even if a separator is missing or an empty string)
dfmt optional format string for numerical vectors and matrices ("%g" by default)
tfmt optional format string for text vectors and matrices ("%s" by default)

Example:
library("xplore")
x = #(1,2.34,3.0,4)
t = #("Hi","test","three", "four")
file = getenv("XPL4OUTDATA") + "/" + "exwrite.dat"
writem(list(x,t), file)
r = readm(file)
r

Result:
The file written to "exwrite.dat" contains lines

1       Hi
2.34    test
3       three
4       four

and the output window contains

Contents of string
[1,] "readm: Found    4 line(s) and    2 column(s)"

Contents of r.type
[1,]        0
[2,]        1

Contents of r.double
[1,]        1
[2,]     2.34
[3,]        3
[4,]        4

Contents of r.text
[1,] "Hi"
[2,] "test"
[3,] "three"
[4,] "four"



Author: P. Cizek, 20020708
(C) MD*TECH Method and Data Technologies, 05.02.2006