dataFileInfo
Information from an External Data File

### Description

Reads an external data file and returns the variable names, variable types, and, optionally, the number of observations.

### Usage

    dataFileInfo(file = "", format = NULL, countRows = TRUE)

### Arguments

file | a character string containing the name of the file to read.
format | a character string specifying the format of file. It must be one of the values from the FormatTag column in the stattranFileFormats data set. Typically, this argument is not required, because if it is not supplied the file extension on the file argument determimes the format.
countRows | a logical value. If TRUE (the default), the number of rows (observations) computed and returned. If file is large, the function is faster if it is called called with countRows set to FALSE.

Value
returns a list with the following components.
Names
a character vector containing the names of the variables.
VarType
a character vector containing the type of the variables. Possible values are "numeric", "character", "date", and "datetime".
N
the number of observations in file. N is returned only if countRows is TRUE.
File
the file argument.
See Also
importData
Examples

    tf <- paste0(tempfile(), ".csv")
    n <- exportData(data.frame(x = 1:5, c = letters[11:15],
        d = seq.Date(as.Date("2011-05-23"), by=1, length.out=5)), file=tf)
    dataFileInfo(tf)
    ## $Names
    ## [1] "x" "c" "d"
    ##
    ## $VarType
    ## [1] "numeric"   "character" "date"
    ##
    ## $N
    ## [1] 5
    ##
    ## $File
    ## [1] "/tmp/RtmpDBosz9/file54a25a5d888.csv"

Package stattran version 6.1.5-18
Package Index