getSymbols.csv: Load Data from csv File

Description Usage Arguments Details Value Note Author(s) See Also Examples

Description

Downloads Symbols to specified env from local comma seperated file. This method is not to be called directly, instead a call to getSymbols(Symbols,src='csv') will in turn call this method. It is documented for the sole purpose of highlighting the arguments accepted, and to serve as a guide to creating additional getSymbols ‘methods’.

Usage

1
2
3
4
5
6
getSymbols.csv(Symbols,
                 env,
                 dir="",
                 return.class = "xts",
                 extension="csv",
                  ...)

Arguments

Symbols

a character vector specifying the names of each symbol to be loaded

env

where to create objects. (.GlobalEnv)

dir

directory of csv file

return.class

class of returned object

extension

extension of csv file

...

additional parameters

Details

Meant to be called internally by getSymbols (see also).

One of a few currently defined methods for loading data for use with quantmod. Essentially a simple wrapper to the underlying R read.csv.

Value

A call to getSymbols.csv will load into the specified environment one object for each Symbol specified, with class defined by return.class. Presently this may be ts, its, zoo, xts, or timeSeries.

Note

This has yet to be tested on a windows platform. It should work though file seperators may be an issue.

Author(s)

Jeffrey A. Ryan

See Also

getSymbols, read.csv, setSymbolLookup

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
## Not run: 
# All 3 getSymbols calls return the same
# MSFT to the global environment
# The last example is what NOT to do!

## Method #1
getSymbols('MSFT',src='csv')


## Method #2
setDefaults(getSymbols,src='csv')
  # OR
setSymbolLookup(MSFT='csv')

getSymbols('MSFT')

#########################################
##  NOT RECOMMENDED!!!
#########################################
## Method #3
getSymbols.csv('MSFT',verbose=TRUE,env=globalenv())

## End(Not run)

Example output

Loading required package: xts
Loading required package: zoo

Attaching package: 'zoo'

The following objects are masked from 'package:base':

    as.Date, as.Date.numeric

Loading required package: TTR
Version 0.4-0 included new data defaults. See ?getSymbols.
    As of 0.4-0, 'getSymbols' uses env=parent.frame() and
 auto.assign=TRUE by default.

 This  behavior  will be  phased out in 0.5-0  when the call  will
 default to use auto.assign=FALSE. getOption("getSymbols.env") and 
 getOptions("getSymbols.auto.assign") are now checked for alternate defaults

 This message is shown once per session and may be disabled by setting 
 options("getSymbols.warning4.0"=FALSE). See ?getSymbols for more details.

file  MSFT.csv  does not exist  in   ....skipping
[1] "MSFT"

file  MSFT.csv  does not exist  in   ....skipping
[1] "MSFT"
loading  MSFT .....
file  MSFT.csv  does not exist  in   ....skipping
[1] "MSFT"

quantmod documentation built on May 2, 2019, 5:48 p.m.