returnCalculationsPowerpoint

returnCalculationsPowerpoint - Return Calculations in...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
eturn Calculations in R Return Calculations in R Econ 424 Fall 2010 ric Zivot Eric Zivot Updated: October 8, 2010 © Eric Zivot 2006
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
xample Data Example Data # Set output options and location of data ptions digits = 4) > options (digits = 4) > options (width = 75) > loadPath = "C:\\Users\\ezivot.SOCIOLOGY\\Documents\\FinBook\\excel\\" read data into R # read data into R > sbux.df = read.csv (file=paste(loadPath, "sbuxPrices.csv", sep=""), + header=TRUE, stringsAsFactors=FALSE) > msft.df = read.csv (file=paste(loadPath, "msftPrices.csv", sep=""), header=TRUE, tringsAsFactors FALSE) + header TRUE, stringsAsFactors FALSE) > class (sbux.df) [1] "data.frame“ > str (sbux.df) 'data.frame': 181 obs. of 2 variables: $ Date : chr "3/31/1993" "4/1/1993" "5/3/1993" "6/1/1993" . .. $ Adj.Close: num 1.19 1.21 1.5 1.53 1.48 1.52 1.71 1.67 1.39 1.39 © Eric Zivot 2006
Background image of page 2
xample Data Example Data > head (sbux.df) Date Adj.Close 1 3/31/1993 1.19 2 4/1/1993 1.21 3 5/3/1993 1.50 4 6/1/1993 1.53 5 7/1/1993 1.48 6 8/2/1993 1.52 > colnames (sbux.df) [1] "Date" "Adj.Close" > class (sbux.df$Date) [1] "character" > class (sbux.df$Adj.Close) [1] "numeric" © Eric Zivot 2006
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
lot Prices Plot Prices # Create line plot of msft prices > plot (msft.df$Adj.Close, type = "l", lty = "solid", lwd = 2,
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 13

returnCalculationsPowerpoint - Return Calculations in...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online