Is there a way to define a current quarter in R? - 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.

Related

What is the graphics::par(op) in R?

Working with Quanteda in R, and passing DTM to textplot_wordcloud returns the following error
Error in graphics::par(op) :
invalid value specified for graphical parameter "pin"
There's one other question but the answer refers to a specific package that forces the issue and so a workaround is given that is unclear to me. What does this refer to and how can I go about debugging this? I've never come across the "pin" before but I'm presuming this is related to positioning on the graphical plane somehow. Just unsure how to alter settings in quanteda textplot_wordcloud? Any guidance appreciated.

Error: ebirdst::calc_full_extent() function does not exist

I am trying to use the ebirdst package for some exploratory data analysis, following this tutorial. Everything going according to plan until I run this line:
week_ext <- calc_full_extent(occ_proj)
and get this error:
Error in calc_full_extent(occ_proj) : could not find function "calc_full_extent"
I know sometimes new functions won't show up, or it can be a version issue, but the tutorial I'm referencing is from 2018 and everything else works perfectly. Does anyone know why a crucial function would just not be there? Or what steps to take? I've looked to see if there are any analogous functions and can't find any.
Also this is my first stackoverflow question--I've always been able to solve my issues based on existing questions, but there seems to be very little out there on ebirdst--so please let me know if I need to provide more info/context.
Thanks!

Identifying required packages from code

I want to follow the tutorial found on this site, but despite being thorough in all other aspects, the author has not included information on what packages need to be used for the code to function.
As far as I understand one of them will be the PerformanceAnalytics package, yet my inexperienced eye is not sure about what else I will need to include.
The fapply function used in the code is one example that I cannot find.
fapply()
Error: could not find function "fapply"
library(sos)
findFn("fapply", sortby = "Function")
The findFN(...) function is great. It should open an internet browser window with the search results by itself at least it does for me.
The tutorial on Backtesting a Trading Strategy uses time series data as seen its part 1 and part 2. fapply is also used in part 2
As the data being collected and processed is time-series data, fapply() function belongs to far package which is used for Modelization for Functional AutoRegressive Processes.
I hope this helps.

Need help, I stuck when install (VGAM) and how to use mlogit. I don't understand from that pdf example

I need help for my problems. I have 2 problems.
I can't install library (VGAM) on my RStudio. Have any idea for another regression logistic ordinal package or have solution for my problem?
I Stuck for the first step when used mlogit. I have dependent variable = Kategori.Kredit with 3 option. And I have independent variable = FD,FC,ND,NC,CASA. Please help me to solve this problem, I try read example on pdf but still didn't understand.
Please, don't post two completely different questions at the same time.
Don't post code as image. Post as text
About number 2, it seems that your data is in the wide format, while mlogit need it in the long one. Use the function mlogit.data to get your data ready. The manual has some good examples about mlogit.data

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