"subscript out of bounds" for matchTab in epicalc package in R - r

As title, I have collected data for 1:6 matched case-control study and I am trying to analyze the data using matchTab, but it gives me error "subscript out of bounds", I wonder if anyone here has met anything similar before. What does it mean? Some issue about my dataset? As I have tried the manual, I can get the result using the dataset used in the manual.
Thanks.

That error often arises from matrix subsetting beyond the dimensions of the object. Try this for example:
mat <- matrix(1:9, ncol = 3)
mat[,4]
with the last line yielding
> mat[,4]
Error: subscript out of bounds
This sometimes happens in code because the programmer forgot that [ drops empty dimensions - I've done this myself many times, forgetting the 1 column matrix case! I'm not saying this is the problem here, but is one common cause of it in R code.
As you haven't provided a reproducible example and I am unfamiliar with the package you mention, I can't diagnose the problem further. It could be a bug in their package or a problem with how you have supplied, or understood you needed to supply, data to the function.
First thing I would do is re-read the man page for the function. Confirm you have the arguments supplied correctly. If that doesn't help, rerun to generate the error and then call traceback() to see exactly in what function the error is being raised. To debug further, try
options(error = recover)
then rerun your code. This will drop you into the debugger so you can go into the frame where the error occurred and see what all the objects were like, how they were sized etc. and why the error was being raised.
If you are not up to debugging this yourself, you might need to contact the maintainers, or provide a reproducible example...

Related

How to fix an error displayed while modelfitting in Rstudio?

Want to study the regime switching of a time series using MSGARCH package in Rstudio. After specifying the model, tried to fit the model using data of series using FitML function.I have used the following code to fit data.
msgarch_fit=FitML(msgarch_spec,data="log_ret") ## I have found the log return of the series and saved it in the vector named "log_ret".
But the following error is displayed.
"Error in f_check_y(data) : y must be numeric"
Being a beginner I can't understand the meaning of it. It would be of great help if someone can explain.
I tried to execute the code but error was displayed.
I was expecting to get the summary output.
Thank you

Need help to understand ctree plot warnings()

First time asking a question.
I am relatively new to using R. Using it on a project for the Party package (cforest, ctree) which has no implementation in Python.
I receive no warnings in my code until I plot a ctree, at which point I get a varying number of the same two warnings each time I plot a new ctree. The two types of warnings are shown below:
Warning messages:
In model#fit(data, ...) : cmvnorm: completion with ERROR > EPS
In model#fit(data, ...) : cmvnorm: N > 1000 or N < 1
I’ve determined these warnings are coming from the libcoin package, but I don’t understand them.
To be clear, I am getting a plot. The results seem reasonable. I just want to know what these warnings are trying to convey so I can know to disregard or not.
Any help is appreciated.

Is there a way to define a current quarter in R?

I have written a small program in R, and when I get to this following line:
i=which(grepl(yyyy.q, Metrop$year))+1
I get the following error message:
Error in grepl(yyyy.q, Metrop$year) : object 'yyyy.q' not found
I think maybe this is occurring because I haven't defined 2019.3 as the current "yyyy.q". And that is what I need to do in order to tell R to start forecasting according to my model. Does that seem like the likely problem? I thought that was the problem but have struggled to fix it.
Here is how I am defining things in the beginning of my program before I get to the actual model specification, I assume the full code isn't necessary, but happy to share if that helps.
Metrop<-Houston
name<-"National"
Metrop<-Metrop[Metrop$year>=1989.4,]
Screenshot of dataset
Thanks for you help. Happy to share any more code or data if necessary.

Clustering with bigkmeans from bigmemory package in R?

I recently started experimenting with the biganalytics package for R. I ran into a problem however...
I am trying to run bigkmeans with a cluster number of about 2000 e.g clust <- bigkmeans(mymatrix, centers=2000)
However, I get the following error:
Error in 1:(10 + 2^k) : result would be too long a vector
Can someone maybe give me a hint what I am doing wrong here?
Vectors are limited by the type used for the index -- there is/was some talk about replacing this index type by a double but it hasn't happen yet and is unlikely as it may break so much existing code.
If your k is really large, you may not be able to do this the way you had planned.

Bootstrap output matrix missing

When I try to calculate Gest in spatstat I get the error:
bootstrap output matrix missing.
Does anyone know what am I doing wrong?
I think that "bootstrap output matrix missing" is a fairly generic error, and (unless someone has explicit experience with your case) I would imagine that more information is needed to solve this.
Without more information, I would suggest that you debug the Gest function. You have two good options for that:
1) Use the debug() function:
debug(Gest)
Now run your code. Then you can walk through the Gest function and see where is breaks. Before that point, look at all the environment variables by (for instance) using ls() and see if any assumptions are broken. Presumably something isn't being set correctly.
2) Use recover:
option(error=recover)
Then you will go into browser mode whenever the error occurs, and you can explore the workspace at that point.
This error message does not originate from the spatstat package.
To identify the location of the error, type traceback() immediately after the error has occurred. This will give you a list of the nested commands that were being executed at the time the error occurred. The top one is the location which raised the error.

Resources