[R] Please guide
jdnewm|| @end|ng |rom dcn@d@v|@@c@@u@
Sat Jul 9 20:48:10 CEST 2022
This is a mailing list whose members are random people with an interest in R. We are not a tech support call center. If we have time, and you invest some effort into making it easier for us to reproduce your problem, then someone may respond... but no guarantees. Your current efforts are missing key elements that impede our efforts and there isn't much here to persuade many people to dig further. You may garner more responses if you make the following changes to your approach:
1) Make your example reproducible. We need access to the data you are working with, or at least a small fake similar data set. We don't have your Excel files... dead end for us. But see next point about files. Also, verify that your code can start from a fresh R environment and demonstrate your problem... the reprex package may be useful for this.
2) Make your example minimal. If you are having trouble with data importing, give us the data file or something similar that gives you the same error. If you are having trouble with data calculations or manipulations, then use dput  to give us a snippet of the data you are referring to in the troublesome line of code... don't give us a data file and a bunch of code that isn't giving you trouble before the error code... we don't want to wade through it.
3) Remove garbage from your posts (formatting). Look at the extra asterisks in your message as we see it . We cannot run this code without guessing which symbols belong and which don't. I know you did not put them there intentionally, but neither did you disable HTML formatting in your email client when you composed the message, and that was responsible for the extra mess. The Posting Guide warns you to post plain text, and there are way too many email client programs out there for us to be able to tell you how to alter this setting... but it is essential that you do it if you want to encourage responses here.
I considered not responding at all due to these deficiencies, but figured I would spell out the problems you have missed in the Posting Guide once. Mailing lists are tough ways to get help... but the expertise here is kind of rare. You decide whether to make things easy or hard for yourself.
As for the "con =" line below, it seems to have nothing at all to do with the code or data referred to earlier. That would be a hint for point 2 above. Try calling the read_excel function alone without the rest of the indexing and matrix conversion. Only when the result you get from that step makes sense should you try indexing it or converting it. Maybe you need a "sheet=" argument?
On July 9, 2022 10:40:29 AM PDT, Muhammad Zubair Chishti <mzchishti using eco.qau.edu.pk> wrote:
>A kind reminder. Please help me.
>On Fri, 8 Jul 2022, 21:56 Muhammad Zubair Chishti, <mzchishti using eco.qau.edu.pk>
>> *Dear Experts,*
>> *Greetings from Pakistan*.
>> *When I run the following code in R*
>> ##Add data here##
>> Data <- read_excel("Data_oil_agri.xlsx", sheet = "Sheet1")
>> Data <- Data[,2:22]
>> lags=VARselect(Data, lag.max = 12, type = "const") ## "const", "trend",
>> "both", "none"
>> est <- VAR(Data, p = p, type = "const")
>> sp <- spilloverDY12(est, n.ahead = 10, no.corr = F)
>> params_est = list(p = p, type = "const")
>> sp_roll <- spilloverRollingDY12(Data, n.ahead = 10, no.corr = F, "VAR",
>> params_est = params_est, window = 260)
>> bounds <- c(pi+0.00001, pi/5, 0)
>> sp_bk <- spilloverBK12(est, n.ahead = 100, no.corr = F, partition = bounds)
>> sp_bk_roll <- spilloverRollingBK12(Data, n.ahead = 100, no.corr = F,
>> func_est = "VAR", params_est = params_est, window = 260, partition = bounds)
>> **Till now the code works well. After that, when I run the following:*
>> con = as.matrix(read_excel("DY_Table.xlsx")[,-1])*100
>> *I face the following error:*
>> *Error in* *`vectbl_as_col_location()`:*
>> ! Can't negate columns past the end.
>> ℹ Location 1 doesn't exist.
>> ℹ There are only 0 columns.
>> Run `rlang::last_error()` to see where the error occurred.
>> Kindly please guide me.
>> Muhammad Zubair Chishti
>> Ph.D. Student
>> School of Business,
>> Zhengzhou University, Henan, China.
>> My Google scholar link:
>> My ResearchGate link:
> [[alternative HTML version deleted]]
>R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.
Sent from my phone. Please excuse my brevity.
More information about the R-help