Learn R Programming

PerformanceAnalytics (version 0.9.7.1)

Return.read: Read returns data with different date formats

Description

A simple wrapper of read.zoo with some defaults for different date formats

Usage

Return.read(filename = stop("Please specify a filename"),
                 frequency = c("m", "d", "q", "i", "o"), format.in =
                 c("ISO8601", "excel", "oo", "gnumeric"), sep = ",",
                 header = TRUE, check.names = FALSE, ...)

Arguments

filename
the name of the file to be read
frequency
  • "d" sets as a daily timeseries usingas.Date,
  • "m" sets as monthly timeseries usingas.yearmon,
  • "q" sets as a quarterly timeseries
format.in
says how the data being read is formatted. Although the default is set to the ISO 8601 standard (which can also be set as "%F"), most spreadsheets have less sensible date formats as defaults. See below.
sep
separator, default is ","
header
a logical value indicating whether the file contains the names of the variables as its first line.
check.names
logical. If TRUE then the names of the variables in the data frame are checked to ensure that they are syntactically valid variable names. If necessary they are adjusted (by make.names) so that they are, and also to ensure that there are no duplicates. Se
...
passes through any other parameters to read.zoo

Value

  • A zoo object containing a representation of the data in the file.

Details

The parameter 'format.in' takes several values, including:
  • excel: default date format for MS Excel spreadsheet csv format, which is "\%m/\%d/\%Y",
  • oo: default date format for OpenOffice spreadsheet csv format, "\%m/\%d/\%y", although this may be operating system dependent,
  • gnumeric: default date format for Gnumeric spreadsheet, which is "\%d-\%b-\%Y",
  • ...: alternatively, any specific format may be passed in, such as "\%M/\%y"

See Also

read.zoo, read.table