Displaying 4 results from an estimated 4 matches for "econ424".
Did you mean:
conv24
2017 Sep 18
3
Convert data into zoo object using Performance analytics package
Dear All,
While i am trying convert data frame object to zoo object I am
getting numeric(0) error in performance analytics package.
The source code i am using from this website to learn r in finance:
https://faculty.washington.edu/ezivot/econ424/returnCalculations.r
# create zoo objects from data.frame objects
dates.sbux = as.yearmon(sbux.df$Date, format="%m/%d/%Y")
dates.msft = as.yearmon(msft.df$Date, format="%m/%d/%Y")
sbux.z = zoo(x=sbux.df$Adj.Close, order.by=dates.sbux)
msft.z = zoo(x=msft.df$Adj.Close, order.by=...
2017 Sep 20
1
Convert data into zoo object using Performance analytics package
...;> Depending on how you created df maybe your code has the column names
>> wrong. In any case these 4 alternatives all work. Start a fresh R
>> session and then copy and paste this into it.
>>
>> library(zoo)
>> u <- "https://faculty.washington.edu/ezivot/econ424/sbuxPrices.csv"
>> fmt <- "%m/%d/%Y"
>>
>> # 1
>> sbux1.z <- read.csv.zoo(u, FUN = as.yearmon, format = fmt)
>>
>> # 2
>> df <- read.csv(u)
>> sbux2.z <- read.zoo(df, FUN = as.yearmon, format = fmt)
>>
>> # 3
>...
2017 Sep 22
1
Convert data into zoo object using Performance analytics package
Dear All,
Thanks a lot for your help. Would you please let me know if i want to read
a csv file as zoo object from my local file rather than directly from the
website, how to do that?
library(zoo)
u <- "https://faculty.washington.edu/ezivot/econ424/sbuxPrices.csv"
fmt <- "%m/%d/%Y"
With sincere regards,
Upananda Pani
On Wed, Sep 20, 2017 at 3:22 PM, PIKAL Petr <petr.pikal at precheza.cz> wrote:
> Hi
>
> Gabor's code works as expeceted without error.
> What is "u" in your case?
>
> Che...
2017 Sep 20
0
Convert data into zoo object using Performance analytics package
...u created df maybe your code has the column names
> >> wrong. In any case these 4 alternatives all work. Start a fresh R
> >> session and then copy and paste this into it.
> >>
> >> library(zoo)
> >> u <- "https://faculty.washington.edu/ezivot/econ424/sbuxPrices.csv"
> >> fmt <- "%m/%d/%Y"
> >>
> >> # 1
> >> sbux1.z <- read.csv.zoo(u, FUN = as.yearmon, format = fmt)
> >>
> >> # 2
> >> df <- read.csv(u)
> >> sbux2.z <- read.zoo(df, FUN = as.yearmon,...