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: readcsv writecsv read write readm writem readascii

Quantlet: readcsvm
Description: readcsvm reads mixed data from a CSV file

Usage: z=readcsvm(filename{,separators,fastcsv,rrow,rcol})
Input:
filename string, name of the file
separators string that contains the data separator in the file (default = ";", it is used even if string is missing or empty))
fastcsv an optional scalar; if non-zero (default), the fast CSV import is used assuming that there is no special formatting using quotation marks in the file
rrow an optional p1 x 2 matrix (if you enter a scalar, it will be ignored) specifies, which rows should be read. Every row consists of two numbers, r1 and r2: 1) if both numbers are positive, they specify that rows with indices {r1,...,r2} should be read in; 2) if both number are negative, they specify that rows with indices {|r1|,...,|r2|} should be excluded from reading; 3) it is not possible to mix inclusion and exclusion conditions. If the parameter is omitted or is a scalar, all rows are read.
rcol an optional p2 x 2 matrix (if you enter a scalar, it will be ignored) specifies, which columns should be read. Every column consists of two numbers, r1 and r2: 1) if both numbers are positive, they specify that columns with indices {r1,...,r2} should be read in; 2) if both number are negative, they specify that columns with indices {|r1|,...,|r2|} should be excluded from reading; 3) it is not possible to mix inclusion and exclusion conditions. If the parameter is omitted or is a scalar, all columns are read.
Output:
z.type (p+q) vector, types of columns in the file
z.double n x p matrix, numerical vectors; this component equals zero if p == 0, i.e., when there are no numerical columns in the file
z.text n x q matrix, text vectors; this component contains an empty string if q == 0, i.e., when there are no text columns in the file

Note:

Example:
library("xplore")
readcsvm("example.csv")

Result:
Contents of string

[1,] "readm: Found    3 line(s) and    3 column(s)"

Contents of z.type

[1,]        1
[2,]        0
[3,]        1

Contents of z.double

[1,]      5.4
[2,]      4.6
[3,]     +NAN

Contents of z.text

[1,] "hallo" "john"
[2,] "" " "
[3,] "hi" "george"
Example:
library("xplore")
readcsvm("example.csv", "", 1, 0, -1~-1)

Result:
The same example as before, but now the first column
is omitted. Notice that the separator is an empty
string, so the default separators are used.

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

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

Contents of z.double
[1,]      5.4
[2,]      4.6
[3,]     +NAN

Contents of z.text
[1,] "john"
[2,] " "
[3,] "george"



Author: M. Benko, P. Cizek, W: Haerdle, 20020325 license MD*Tech
(C) MD*TECH Method and Data Technologies, 05.02.2006