Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in if (type == "Date" || type == "yearmon" || type == "yearqtr") temp = as.Date(temp) : #37

Open
ejlamarque opened this issue Feb 29, 2020 · 3 comments

Comments

@ejlamarque
Copy link

ejlamarque commented Feb 29, 2020

Hi, I have this error. Somebody could help to deal with it please?
In Charting the Santa Claus Rally

plota.test()
Error in if (type == "Date" || type == "yearmon" || type == "yearqtr") temp = as.Date(temp) :
missing value where TRUE/FALSE needed
Called from: index.xts(y1)
When I try to run some parts of the code I found the same error.
Buy the way this is still working for somebody? I have lots of code not working.
There is some instructions step by step? Thank you

@systematicinvestor
Copy link
Owner

Please try updating SIT and SIT.date packages

devtools::install_github('systematicinvestor/SIT.date')
curl::curl_download('https://github.com/systematicinvestor/SIT/raw/master/SIT.tar.gz', 'SIT.tar.gz',mode = 'wb',quiet=T)
install.packages('SIT.tar.gz', repos = NULL, type='source')

If you still get some warnings regarding indexClass, please install development version of xts and quantmod packages:

devtools::install_github('joshuaulrich/xts')
devtools::install_github('joshuaulrich/quantmod')

@ejlamarque
Copy link
Author

Hello. Thank you very much for your support. I am a newbie learner of R and I am amazed by your job (All of them and your codes)
Well, The tools that you suggested seem to work because I pass this step, but now I have the following errors that I don't know if there are related or not but always stack I am.

I run this:

find prices in December

dates = index(prices)
years = date.year(dates)
index = which(date.month(dates) == 12)

rearrange data in trading days

trading.days = sapply(tapply(ret[index,], years[index], function(x) coredata(x)), function(x) x[1:22])

and I returned this:

find prices in December

dates = index(prices)
years = date.year(dates)
Error in as.POSIXlt.numeric(dates) : 'origin' must be supplied
index = which(date.month(dates) == 12)
Error in as.POSIXlt.numeric(dates) : 'origin' must be supplied

rearrange data in trading days

trading.days = sapply(tapply(ret[index,], years[index], function(x) coredata(x)), function(x) x[1:22])
Error in tapply(ret[index, ], years[index], function(x) coredata(x)) :
object 'years' not found
Suggestions?

@ejlamarque
Copy link
Author

Now work perfectly. Thank you for your help. You can close the Issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants