Return level in R - r

I am trying to compute return levels for a certain return period (20 years) for my extreme precipitation. Using the block maxima approach, I made the following object to extract the maximum values:
Gcomb <-c(Gmax[1], Gmax1[1], Gmax2[1], Gmax3[1], Gmax4[1], Gmax5[1], Gmax6[1], Gmax7[1], Gmax8[1],
Gmax[2], Gmax1[2], Gmax2[2], Gmax3[2], Gmax4[2], Gmax5[2], Gmax6[2], Gmax7[2], Gmax8[2], Gmax[3],
Gmax1[3], Gmax2[3], Gmax3[3], Gmax4[3], Gmax5[3], Gmax6[3], Gmax7[3], Gmax8[3], Gmax[4], Gmax1[4],
Gmax2[4], Gmax3[4], Gmax4[4], Gmax5[4], Gmax6[4], Gmax7[4], Gmax8[4], Gmax[5], Gmax1[5], Gmax2[5],
Gmax3[5], Gmax4[5], Gmax5[5], Gmax6[5], Gmax7[5], Gmax8[5], Gmax[6], Gmax1[6], Gmax2[6], Gmax3[6],
Gmax4[6], Gmax5[6], Gmax6[6], Gmax7[6], Gmax8[6], Gmax[7], Gmax1[7], Gmax2[7], Gmax3[7], Gmax4[7],
Gmax5[7], Gmax6[7], Gmax7[7], Gmax8[7])
Gcomb looks like this:
>Gcomb
[1] 191.46960 115.77133 209.15147 243.26880 84.97396 157.38678 138.84937
140.96840 143.80301 196.87990 131.89099
[12] 137.08264 231.11342 116.67323 125.27563 100.72293 159.45056 198.12399
216.74820 120.16774 147.73828 396.64862
[23] 164.02292 132.94519 99.95055 162.81708 186.59691 219.53568 124.76086
174.99396 231.20859 108.70350 139.22649
[34] 160.40935 159.03806 162.56891 217.58543 123.11100 149.26378 245.90994
92.68985 152.45033 171.12381 159.27040
[45] 141.19446 205.46706 101.71022 163.25592 328.31265 119.69154 122.01060
114.79624 147.92126 179.91318 200.70750
[56] 110.50108 231.30966 213.02881 125.74141 152.19133 98.35700 204.43138
182.53252
Now, when I try to compute the return level (a 20-year return level):
library(extRemes)
return.level.fevd(Gcomb, return.period = 20)
I end up with the following error:
Error: $ operator is invalid for atomic vectors
What could be causing this error? I tried creating a vector with the same values, but the error persists
Any help or insight for this would be very appreciated!

Related

Incomplete Expression in R

I'm currently running a time series script in R-Markdown where I pass the values of Percent Use and another vector of the time values. I am processing the two separate vectors with the regular c() function within r. The percentage vector is able to be passed through when compilining like normal, however I am running into trouble with the date/time vector. The length of both vectors are 749, the percentage vector just has values 0-100 passed within them. THe date/time vector has strings passed into them as such:
dt=c('2022-06-19 14:05:00.0','2022-06-19 14:06:00.0', ....
If I only pass a few arguments into the dt vector, it will compile regularly, however, once I increase the size to around half of what it needs to be I start getting the following error:
Error: Incomplete expression: dt=c('2022-06-19 12:40:00.0','2022-06-19 12:41:00.0','2022-06-19 12:42:00.0','2022-06-19 12:43:00.0','2022-06-19 12:44:00.0','2022-06-19 12:45:00.0','2022-06-19 12:46:00.0','2022-06-19 12:47:00.0','2022-06-19 12:48:00.0','2022-06-19 12:49:00.0','2022-06-19 12:50:00.0','2022-06-19 12:51:00.0','2022-06-19 12:52:00.0','2022-06-19 12:53:00.0','2022-06-19 12:54:00.0','2022-06-19 12:55:00.0','2022-06-19 12:56:00.0','2022-06-19 12:57:00.0','2022-06-19 12:58:00.0','2022-06-19 12:59:00.0','2022-06-19 13:00:00.0','2022-06-19 13:01:00.0','2022-06-19 13:02:00.0','2022-06-19 13:03:00.0','2022-06-19 13:04:00.0','2022-06-19 13:05:00.0','2022-06-19 13:06:00.0','2022-06-19 13:07:00.0','2022-06-19 13:08:00.0','2022-06-19 13:09:00.0','2022-06-19 13:10:00.0','2022-06-19 13:11:00.0','2022-06-19 13:12:00.0','2022-06-19 13:13:00.0','2022-06-19 13:14:00.0','2022-06-19 13:15:00.0','2022-06-19 13:16:00.0','2022-06-19 13:17:00.0','2022-06-19 13:18:00.0','2022-06-19 13:19:00.0','2022
At first I believed it could be a parenthesis in the wrong place, however, there is no mistakes with that. I've looked at other articles with somewhat similar issues and have seen a concept of a maximum size vector allowed, however the percentage vector was able to pass all 700. Is there a way to bypass this error, I feel that it is a memory/storage issue with R.
The full code is a lot but it is:
dt=c('2022-06-19 12:40:00.0','2022-06-19 12:41:00.0','2022-06-19 12:42:00.0','2022-06-19 12:43:00.0','2022-06-19 12:44:00.0','2022-06-19 12:45:00.0','2022-06-19 12:46:00.0','2022-06-19 12:47:00.0','2022-06-19 12:48:00.0','2022-06-19 12:49:00.0','2022-06-19 12:50:00.0','2022-06-19 12:51:00.0','2022-06-19 12:52:00.0','2022-06-19 12:53:00.0','2022-06-19 12:54:00.0','2022-06-19 12:55:00.0','2022-06-19 12:56:00.0','2022-06-19 12:57:00.0','2022-06-19 12:58:00.0','2022-06-19 12:59:00.0','2022-06-19 13:00:00.0','2022-06-19 13:01:00.0','2022-06-19 13:02:00.0','2022-06-19 13:03:00.0','2022-06-19 13:04:00.0','2022-06-19 13:05:00.0','2022-06-19 13:06:00.0','2022-06-19 13:07:00.0','2022-06-19 13:08:00.0','2022-06-19 13:09:00.0','2022-06-19 13:10:00.0','2022-06-19 13:11:00.0','2022-06-19 13:12:00.0','2022-06-19 13:13:00.0','2022-06-19 13:14:00.0','2022-06-19 13:15:00.0','2022-06-19 13:16:00.0','2022-06-19 13:17:00.0','2022-06-19 13:18:00.0','2022-06-19 13:19:00.0','2022-06-19 13:20:00.0','2022-06-19 13:21:00.0','2022-06-19 13:22:00.0','2022-06-19 13:23:00.0','2022-06-19 13:24:00.0','2022-06-19 13:25:00.0','2022-06-19 13:26:00.0','2022-06-19 13:27:00.0','2022-06-19 13:28:00.0','2022-06-19 13:29:00.0','2022-06-19 13:30:00.0','2022-06-19 13:31:00.0','2022-06-19 13:32:00.0','2022-06-19 13:33:00.0','2022-06-19 13:34:00.0','2022-06-19 13:35:00.0','2022-06-19 13:36:00.0','2022-06-19 13:37:00.0','2022-06-19 13:38:00.0','2022-06-19 13:39:00.0','2022-06-19 13:40:00.0','2022-06-19 13:41:00.0','2022-06-19 13:42:00.0','2022-06-19 13:43:00.0','2022-06-19 13:44:00.0','2022-06-19 13:45:00.0','2022-06-19 13:46:00.0','2022-06-19 13:47:00.0','2022-06-19 13:48:00.0','2022-06-19 13:49:00.0','2022-06-19 13:50:00.0','2022-06-19 13:51:00.0','2022-06-19 13:52:00.0','2022-06-19 13:53:00.0','2022-06-19 13:54:00.0','2022-06-19 13:55:00.0','2022-06-19 13:56:00.0','2022-06-19 13:57:00.0','2022-06-19 13:58:00.0','2022-06-19 13:59:00.0','2022-06-19 14:00:00.0','2022-06-19 14:01:00.0','2022-06-19 14:02:00.0','2022-06-19 14:03:00.0','2022-06-19 14:04:00.0','2022-06-19 14:05:00.0','2022-06-19 14:06:00.0','2022-06-19 14:07:00.0','2022-06-19 14:08:00.0','2022-06-19 14:09:00.0','2022-06-19 14:10:00.0','2022-06-19 14:11:00.0','2022-06-19 14:12:00.0','2022-06-19 14:13:00.0','2022-06-19 14:14:00.0','2022-06-19 14:15:00.0','2022-06-19 14:16:00.0','2022-06-19 14:17:00.0','2022-06-19 14:18:00.0','2022-06-19 14:19:00.0','2022-06-19 14:20:00.0','2022-06-19 14:21:00.0','2022-06-19 14:22:00.0','2022-06-19 14:23:00.0','2022-06-19 14:24:00.0','2022-06-19 14:25:00.0','2022-06-19 14:26:00.0','2022-06-19 14:27:00.0','2022-06-19 14:28:00.0','2022-06-19 14:29:00.0','2022-06-19 14:30:00.0','2022-06-19 14:31:00.0','2022-06-19 14:32:00.0','2022-06-19 14:33:00.0','2022-06-19 14:34:00.0','2022-06-19 14:35:00.0','2022-06-19 14:36:00.0','2022-06-19 14:37:00.0','2022-06-19 14:38:00.0','2022-06-19 14:39:00.0','2022-06-19 14:40:00.0','2022-06-19 14:41:00.0','2022-06-19 14:42:00.0','2022-06-19 14:43:00.0','2022-06-19 14:44:00.0','2022-06-19 14:45:00.0','2022-06-19 14:46:00.0','2022-06-19 14:47:00.0','2022-06-19 14:48:00.0','2022-06-19 14:49:00.0','2022-06-19 14:50:00.0','2022-06-19 14:51:00.0','2022-06-19 14:52:00.0','2022-06-19 14:53:00.0','2022-06-19 14:54:00.0','2022-06-19 14:55:00.0','2022-06-19 14:56:00.0','2022-06-19 14:57:00.0','2022-06-19 14:58:00.0','2022-06-19 14:59:00.0','2022-06-19 15:00:00.0','2022-06-19 15:01:00.0','2022-06-19 15:02:00.0','2022-06-19 15:03:00.0','2022-06-19 15:04:00.0','2022-06-19 15:05:00.0','2022-06-19 15:06:00.0','2022-06-19 15:07:00.0','2022-06-19 15:08:00.0','2022-06-19 15:09:00.0','2022-06-19 15:10:00.0','2022-06-19 15:11:00.0','2022-06-19 15:12:00.0','2022-06-19 15:13:00.0','2022-06-19 15:14:00.0','2022-06-19 15:15:00.0','2022-06-19 15:16:00.0','2022-06-19 15:17:00.0','2022-06-19 15:18:00.0','2022-06-19 15:19:00.0','2022-06-19 15:20:00.0','2022-06-19 15:21:00.0','2022-06-19 15:22:00.0','2022-06-19 15:23:00.0','2022-06-19 15:24:00.0','2022-06-19 15:25:00.0','2022-06-19 15:26:00.0','2022-06-19 15:27:00.0','2022-06-19 15:28:00.0','2022-06-19 15:29:00.0','2022-06-19 15:30:00.0','2022-06-19 15:31:00.0','2022-06-19 15:32:00.0','2022-06-19 15:33:00.0','2022-06-19 15:34:00.0','2022-06-19 15:35:00.0','2022-06-19 15:36:00.0','2022-06-19 15:37:00.0','2022-06-19 15:38:00.0','2022-06-19 15:39:00.0','2022-06-19 15:40:00.0','2022-06-19 15:41:00.0','2022-06-19 15:42:00.0','2022-06-19 15:43:00.0','2022-06-19 15:44:00.0','2022-06-19 15:45:00.0','2022-06-19 15:46:00.0','2022-06-19 15:47:00.0','2022-06-19 15:48:00.0','2022-06-19 15:49:00.0','2022-06-19 15:50:00.0','2022-06-19 15:51:00.0','2022-06-19 15:52:00.0','2022-06-19 15:53:00.0','2022-06-19 15:54:00.0','2022-06-19 15:55:00.0','2022-06-19 15:56:00.0','2022-06-19 15:57:00.0','2022-06-19 15:58:00.0','2022-06-19 15:59:00.0','2022-06-19 16:00:00.0','2022-06-19 16:01:00.0','2022-06-19 16:02:00.0','2022-06-19 16:03:00.0','2022-06-19 16:04:00.0','2022-06-19 16:05:00.0','2022-06-19 16:06:00.0','2022-06-19 16:07:00.0','2022-06-19 16:08:00.0','2022-06-19 16:09:00.0','2022-06-19 16:10:00.0','2022-06-19 16:11:00.0','2022-06-19 16:12:00.0','2022-06-19 16:13:00.0','2022-06-19 16:14:00.0','2022-06-19 16:15:00.0','2022-06-19 16:16:00.0','2022-06-19 16:17:00.0','2022-06-19 16:18:00.0','2022-06-19 16:19:00.0','2022-06-19 16:20:00.0','2022-06-19 16:21:00.0','2022-06-19 16:22:00.0','2022-06-19 16:23:00.0','2022-06-19 16:24:00.0','2022-06-19 16:25:00.0','2022-06-19 16:26:00.0','2022-06-19 16:27:00.0','2022-06-19 16:28:00.0','2022-06-19 16:29:00.0','2022-06-19 16:30:00.0','2022-06-19 16:31:00.0','2022-06-19 16:32:00.0','2022-06-19 16:33:00.0','2022-06-19 16:34:00.0','2022-06-19 16:35:00.0','2022-06-19 16:36:00.0','2022-06-19 16:37:00.0','2022-06-19 16:38:00.0','2022-06-19 16:39:00.0','2022-06-19 16:40:00.0','2022-06-19 16:41:00.0','2022-06-19 16:42:00.0','2022-06-19 16:43:00.0','2022-06-19 16:44:00.0','2022-06-19 16:45:00.0','2022-06-19 16:46:00.0','2022-06-19 16:47:00.0','2022-06-19 16:48:00.0','2022-06-19 16:49:00.0','2022-06-19 16:50:00.0','2022-06-19 16:51:00.0','2022-06-19 16:52:00.0','2022-06-19 16:53:00.0','2022-06-19 16:54:00.0','2022-06-19 16:55:00.0','2022-06-19 16:56:00.0','2022-06-19 16:57:00.0','2022-06-19 16:58:00.0','2022-06-19 16:59:00.0','2022-06-19 17:00:00.0','2022-06-19 17:01:00.0','2022-06-19 17:02:00.0','2022-06-19 17:03:00.0','2022-06-19 17:04:00.0','2022-06-19 17:05:00.0','2022-06-19 17:06:00.0','2022-06-19 17:07:00.0','2022-06-19 17:08:00.0','2022-06-19 17:09:00.0','2022-06-19 17:10:00.0','2022-06-19 17:11:00.0','2022-06-19 17:12:00.0','2022-06-19 17:13:00.0','2022-06-19 17:14:00.0','2022-06-19 17:15:00.0','2022-06-19 17:16:00.0','2022-06-19 17:17:00.0','2022-06-19 17:18:00.0','2022-06-19 17:19:00.0','2022-06-19 17:20:00.0','2022-06-19 17:21:00.0','2022-06-19 17:22:00.0','2022-06-19 17:23:00.0','2022-06-19 17:24:00.0','2022-06-19 17:25:00.0','2022-06-19 17:26:00.0','2022-06-19 17:27:00.0','2022-06-19 17:28:00.0','2022-06-19 17:29:00.0','2022-06-19 17:30:00.0','2022-06-19 17:31:00.0','2022-06-19 17:32:00.0','2022-06-19 17:33:00.0','2022-06-19 17:34:00.0','2022-06-19 17:35:00.0','2022-06-19 17:36:00.0','2022-06-19 17:37:00.0','2022-06-19 17:38:00.0','2022-06-19 17:39:00.0','2022-06-19 17:40:00.0','2022-06-19 17:41:00.0','2022-06-19 17:42:00.0','2022-06-19 17:43:00.0','2022-06-19 17:44:00.0','2022-06-19 17:45:00.0','2022-06-19 17:46:00.0','2022-06-19 17:47:00.0','2022-06-19 17:48:00.0','2022-06-19 17:49:00.0','2022-06-19 17:50:00.0','2022-06-19 17:51:00.0','2022-06-19 17:52:00.0','2022-06-19 17:53:00.0','2022-06-19 17:54:00.0','2022-06-19 17:55:00.0','2022-06-19 17:56:00.0','2022-06-19 17:57:00.0','2022-06-19 17:58:00.0','2022-06-19 17:59:00.0','2022-06-19 18:00:00.0','2022-06-19 18:01:00.0','2022-06-19 18:02:00.0','2022-06-19 18:03:00.0','2022-06-19 18:04:00.0','2022-06-19 18:05:00.0','2022-06-19 18:06:00.0','2022-06-19 18:07:00.0','2022-06-19 18:08:00.0','2022-06-19 18:09:00.0','2022-06-19 18:10:00.0','2022-06-19 18:11:00.0','2022-06-19 18:12:00.0','2022-06-19 18:13:00.0','2022-06-19 18:14:00.0','2022-06-19 18:15:00.0','2022-06-19 18:16:00.0','2022-06-19 18:17:00.0','2022-06-19 18:18:00.0','2022-06-19 18:19:00.0','2022-06-19 18:20:00.0','2022-06-19 18:21:00.0','2022-06-19 18:22:00.0','2022-06-19 18:23:00.0','2022-06-19 18:24:00.0','2022-06-19 18:25:00.0','2022-06-19 18:26:00.0','2022-06-19 18:27:00.0','2022-06-19 18:28:00.0','2022-06-19 18:29:00.0','2022-06-19 18:30:00.0','2022-06-19 18:31:00.0','2022-06-19 18:32:00.0','2022-06-19 18:33:00.0','2022-06-19 18:34:00.0','2022-06-19 18:35:00.0','2022-06-19 18:36:00.0','2022-06-19 18:37:00.0','2022-06-19 18:38:00.0','2022-06-19 18:39:00.0','2022-06-19 18:40:00.0','2022-06-19 18:41:00.0','2022-06-19 18:42:00.0','2022-06-19 18:43:00.0','2022-06-19 18:44:00.0','2022-06-19 18:45:00.0','2022-06-19 18:46:00.0','2022-06-19 18:47:00.0','2022-06-19 18:48:00.0','2022-06-19 18:49:00.0','2022-06-19 18:50:00.0','2022-06-19 18:51:00.0','2022-06-19 18:52:00.0','2022-06-19 18:53:00.0','2022-06-19 18:54:00.0','2022-06-19 18:55:00.0','2022-06-19 18:56:00.0','2022-06-19 18:57:00.0','2022-06-19 18:58:00.0','2022-06-19 18:59:00.0','2022-06-19 19:00:00.0','2022-06-19 19:01:00.0','2022-06-19 19:02:00.0','2022-06-19 19:03:00.0','2022-06-19 19:04:00.0','2022-06-19 19:05:00.0','2022-06-19 19:06:00.0','2022-06-19 19:07:00.0','2022-06-19 19:08:00.0','2022-06-19 19:09:00.0','2022-06-19 19:10:00.0','2022-06-19 19:11:00.0','2022-06-19 19:12:00.0','2022-06-19 19:13:00.0','2022-06-19 19:14:00.0','2022-06-19 19:15:00.0','2022-06-19 19:16:00.0','2022-06-19 19:17:00.0','2022-06-19 19:18:00.0','2022-06-19 19:19:00.0','2022-06-19 19:20:00.0','2022-06-19 19:21:00.0','2022-06-19 19:22:00.0','2022-06-19 19:23:00.0','2022-06-19 19:24:00.0','2022-06-19 19:25:00.0','2022-06-19 19:26:00.0','2022-06-19 19:27:00.0','2022-06-19 19:28:00.0','2022-06-19 19:29:00.0','2022-06-19 19:30:00.0','2022-06-19 19:31:00.0','2022-06-19 19:32:00.0','2022-06-19 19:33:00.0','2022-06-19 19:34:00.0','2022-06-19 19:35:00.0','2022-06-19 19:36:00.0','2022-06-19 19:37:00.0','2022-06-19 19:38:00.0','2022-06-19 19:39:00.0','2022-06-19 19:40:00.0','2022-06-19 19:41:00.0','2022-06-19 19:42:00.0','2022-06-19 19:43:00.0','2022-06-19 19:44:00.0','2022-06-19 19:45:00.0','2022-06-19 19:46:00.0','2022-06-19 19:47:00.0','2022-06-19 19:48:00.0','2022-06-19 19:49:00.0','2022-06-19 19:50:00.0','2022-06-19 19:51:00.0','2022-06-19 19:52:00.0','2022-06-19 19:53:00.0','2022-06-19 19:54:00.0','2022-06-19 19:55:00.0','2022-06-19 19:56:00.0','2022-06-19 19:57:00.0','2022-06-19 19:58:00.0','2022-06-19 19:59:00.0','2022-06-19 20:00:00.0','2022-06-19 20:01:00.0','2022-06-19 20:02:00.0','2022-06-19 20:03:00.0','2022-06-19 20:04:00.0','2022-06-19 20:05:00.0','2022-06-19 20:06:00.0','2022-06-19 20:07:00.0','2022-06-19 20:08:00.0','2022-06-19 20:09:00.0','2022-06-19 20:10:00.0','2022-06-19 20:11:00.0','2022-06-19 20:12:00.0','2022-06-19 20:13:00.0','2022-06-19 20:14:00.0','2022-06-19 20:15:00.0','2022-06-19 20:16:00.0','2022-06-19 20:17:00.0','2022-06-19 20:18:00.0','2022-06-19 20:19:00.0','2022-06-19 20:20:00.0','2022-06-19 20:21:00.0','2022-06-19 20:22:00.0','2022-06-19 20:23:00.0','2022-06-19 20:24:00.0','2022-06-19 20:25:00.0','2022-06-19 20:26:00.0','2022-06-19 20:27:00.0','2022-06-19 20:28:00.0','2022-06-19 20:29:00.0','2022-06-19 20:30:00.0','2022-06-19 20:31:00.0','2022-06-19 20:32:00.0','2022-06-19 20:33:00.0','2022-06-19 20:34:00.0','2022-06-19 20:35:00.0','2022-06-19 20:36:00.0','2022-06-19 20:37:00.0','2022-06-19 20:38:00.0','2022-06-19 20:39:00.0','2022-06-19 20:40:00.0','2022-06-19 20:41:00.0','2022-06-19 20:42:00.0','2022-06-19 20:43:00.0','2022-06-19 20:44:00.0','2022-06-19 20:45:00.0','2022-06-19 20:46:00.0','2022-06-19 20:47:00.0','2022-06-19 20:48:00.0','2022-06-19 20:49:00.0','2022-06-19 20:50:00.0','2022-06-19 20:51:00.0','2022-06-19 20:52:00.0','2022-06-19 20:53:00.0','2022-06-19 20:54:00.0','2022-06-19 20:55:00.0','2022-06-19 20:56:00.0','2022-06-19 20:57:00.0','2022-06-19 20:58:00.0','2022-06-19 20:59:00.0','2022-06-19 21:00:00.0','2022-06-19 21:01:00.0','2022-06-19 21:02:00.0','2022-06-19 21:03:00.0','2022-06-19 21:04:00.0','2022-06-19 21:05:00.0','2022-06-19 21:06:00.0','2022-06-19 21:07:00.0','2022-06-19 21:08:00.0','2022-06-19 21:09:00.0','2022-06-19 21:10:00.0','2022-06-19 21:11:00.0','2022-06-19 21:12:00.0','2022-06-19 21:13:00.0','2022-06-19 21:14:00.0','2022-06-19 21:15:00.0','2022-06-19 21:16:00.0','2022-06-19 21:17:00.0','2022-06-19 21:18:00.0','2022-06-19 21:19:00.0','2022-06-19 21:20:00.0','2022-06-19 21:21:00.0','2022-06-19 21:22:00.0','2022-06-19 21:23:00.0','2022-06-19 21:24:00.0','2022-06-19 21:25:00.0','2022-06-19 21:26:00.0','2022-06-19 21:27:00.0','2022-06-19 21:28:00.0','2022-06-19 21:29:00.0','2022-06-19 21:30:00.0','2022-06-19 21:31:00.0','2022-06-19 21:32:00.0','2022-06-19 21:33:00.0','2022-06-19 21:34:00.0','2022-06-19 21:35:00.0','2022-06-19 21:36:00.0','2022-06-19 21:37:00.0','2022-06-19 21:38:00.0','2022-06-19 21:39:00.0','2022-06-19 21:40:00.0','2022-06-19 21:41:00.0','2022-06-19 21:42:00.0','2022-06-19 21:43:00.0','2022-06-19 21:44:00.0','2022-06-19 21:45:00.0','2022-06-19 21:46:00.0','2022-06-19 21:47:00.0','2022-06-19 21:48:00.0','2022-06-19 21:49:00.0','2022-06-19 21:50:00.0','2022-06-19 21:51:00.0','2022-06-19 21:52:00.0','2022-06-19 21:53:00.0','2022-06-19 21:54:00.0','2022-06-19 21:55:00.0','2022-06-19 21:56:00.0','2022-06-19 21:57:00.0','2022-06-19 21:58:00.0','2022-06-19 21:59:00.0','2022-06-19 22:00:00.0','2022-06-19 22:01:00.0','2022-06-19 22:02:00.0','2022-06-19 22:03:00.0','2022-06-19 22:04:00.0','2022-06-19 22:05:00.0','2022-06-19 22:06:00.0','2022-06-19 22:07:00.0','2022-06-19 22:08:00.0','2022-06-19 22:09:00.0','2022-06-19 22:10:00.0','2022-06-19 22:11:00.0','2022-06-19 22:12:00.0','2022-06-19 22:13:00.0','2022-06-19 22:14:00.0','2022-06-19 22:15:00.0','2022-06-19 22:16:00.0','2022-06-19 22:17:00.0','2022-06-19 22:18:00.0','2022-06-19 22:19:00.0','2022-06-19 22:20:00.0','2022-06-19 22:21:00.0','2022-06-19 22:22:00.0','2022-06-19 22:23:00.0','2022-06-19 22:24:00.0','2022-06-19 22:25:00.0','2022-06-19 22:26:00.0','2022-06-19 22:27:00.0','2022-06-19 22:28:00.0','2022-06-19 22:29:00.0','2022-06-19 22:30:00.0','2022-06-19 22:31:00.0','2022-06-19 22:32:00.0','2022-06-19 22:33:00.0','2022-06-19 22:34:00.0','2022-06-19 22:35:00.0','2022-06-19 22:36:00.0','2022-06-19 22:37:00.0','2022-06-19 22:38:00.0','2022-06-19 22:39:00.0','2022-06-19 22:40:00.0','2022-06-19 22:41:00.0','2022-06-19 22:42:00.0','2022-06-19 22:43:00.0','2022-06-19 22:44:00.0','2022-06-19 22:45:00.0','2022-06-19 22:46:00.0','2022-06-19 22:47:00.0','2022-06-19 22:48:00.0','2022-06-19 22:49:00.0','2022-06-19 22:50:00.0','2022-06-19 22:51:00.0','2022-06-19 22:52:00.0','2022-06-19 22:53:00.0','2022-06-19 22:54:00.0','2022-06-19 22:55:00.0','2022-06-19 22:56:00.0','2022-06-19 22:57:00.0','2022-06-19 22:58:00.0','2022-06-19 22:59:00.0','2022-06-19 23:00:00.0','2022-06-19 23:01:00.0','2022-06-19 23:02:00.0','2022-06-19 23:03:00.0','2022-06-19 23:04:00.0','2022-06-19 23:05:00.0','2022-06-19 23:06:00.0','2022-06-19 23:07:00.0','2022-06-19 23:08:00.0','2022-06-19 23:09:00.0','2022-06-19 23:10:00.0','2022-06-19 23:11:00.0','2022-06-19 23:12:00.0','2022-06-19 23:13:00.0','2022-06-19 23:14:00.0','2022-06-19 23:15:00.0','2022-06-19 23:16:00.0','2022-06-19 23:17:00.0','2022-06-19 23:18:00.0','2022-06-19 23:19:00.0','2022-06-19 23:20:00.0','2022-06-19 23:21:00.0','2022-06-19 23:22:00.0','2022-06-19 23:23:00.')
I can understand saying there is a issue with the quotations, but I cant find it anywhere. It seems as there is a maximum allowed in a vector, if I compile only the first quarter of the entries it works, else wise on R studio it gives an error, and in the terminal it just expects more code so it gives you a + to add more instead of >.

Decimals (involuntarily) trimmed from values when loaded into environment

I'm working with R 3.6.1 in Rstudio 1.2.1335.
When I assign the following value from a column in my data frame, the values that have decimals in that column in the dataframe, get trimmed in the value I assign:
Dataframe$Column1 has values [368.121 376.436]
Value <-- Dataframe$Column1
And I run my code chunk;
The environment shows the column values as: Value num [1:2] 368 376
My decimals have gone and I need those. Why does this happen and is there a way to fix it?
EDIT:
Set_1.
380.283 332.108 327.405 371.570 325.832 345.583 396.377 367.020 428.980 389.524 379.597 407.483 456.271 312.084 391.198 345.813 406.229 346.450 459.307 392.321 337.638 429.377 353.705 377.512 384.921 346.471 411.855 368.406 386.921 397.797 322.416 412.042 383.240 381.244 440.021 372.444 399.301 345.395 359.865 355.449 314.270 453.173 329.055 299.674 351.675 324.334 425.205 437.013 513.334 436.452 335.658 422.669 300.030 287.893 380.611 297.890 351.203 317.065 350.824 269.149 389.509 467.375 399.065 354.954 465.086 353.615 336.454 372.067 424.167 389.172 357.799 321.663 353.633 388.465 342.489 353.487 398.721 416.194 383.376 355.553 398.667 339.722 316.240 383.894 453.429 351.443 460.038 348.860 304.085 258.921
264.107 241.861 278.548 455.216 393.201 348.211 359.426 427.194 391.599 381.335 340.558 369.617 351.342 318.718 338.960 386.547 388.872 283.943 340.501
Set_2:
380.603 332.100 327.391 371.540 325.826 345.602 396.386 367.029 428.949 389.545 379.584 407.454 456.276 312.093 391.414 345.861 406.235 346.259 459.284 392.334 337.626 429.283 353.539 377.568 384.941 346.491 411.820 368.253 386.816 397.723 322.337 412.020 383.158 381.331 440.066 372.361 399.210 345.438 359.948 355.425 314.271 453.169 328.751 299.701 351.388 324.371 425.219 436.906 513.384 436.475 335.508 422.661 300.036 287.908 380.453 297.306 351.275 317.206 351.165 269.122 389.499 467.402 399.136 354.943 465.057 353.593 336.549 372.079 424.062 389.119 357.753 321.758 353.650 388.599 342.285 353.507 398.682 416.289 383.309 355.456 398.816 339.681 316.273 383.898 453.418 351.395 460.027 348.731 304.111 258.452
264.298 241.829 278.297 455.104 393.228 348.117 359.645 427.096 391.526 381.260 340.474 369.791 351.061 318.780 338.949 386.458 389.030 284.093 340.512
Code:
plot(Set_1,Set_2,col = "red", xlab="Set_1", ylab = "Set_2",
main = "Comparison Set_1 and Set_2", type = 'p')
abline(fit5<-lm(Set_2~Set_1), col="blue")
r5<-round(summary(fit5)$adj.r.square, 4)
text(410,330, paste("R2=",r5))
The decimals aren't gone, they are just not shown in your enviroment. Try accessing the values by Value[1]. This clearly gives you your desired result 368.121.

Why does Julia throw a premature end of input error when i write and if statement?

This is my code:
using Printf
using Statistics
age = 12
if age < 10
println("$age")
This is the error:
ERROR: LoadError: syntax: incomplete: premature end of input
Stacktrace:
[1] top-level scope at D:\julia\trial.jl:5
[2] include(::Module, ::String) at .\Base.jl:377
[3] exec_options(::Base.JLOptions) at .\client.jl:288
[4] _start() at .\client.jl:484
in expression starting at D:\julia\trial.jl:5
It works well if I remove the if statement and just print the value of age.
Julia terminates its blocks with an end keyword (and does not rely on whitespace to define its blocks).
age = 12
if age < 10
println("$age")
end

Error while fitting data in auto.arima - R

I am running auto.arima for forecasting time series data and getting the following error:
1: The time series frequency has been rounded to support seasonal
differencing.
2: In value[3L] : The chosen test encountered
an error, so no seasonal differencing is selected. Check the time
series data.
This is what I am executing:
fit <- auto.arima(data,seasonal = TRUE, approximation = FALSE)
I have weekly time series data.
This is how dput(data) looks like:
structure(c(12911647L, 12618317L, 12827388L, 12967840L, 13264925L,
13557838L, 13701131L, 13812463L, 13971928L, 13837658L, 13550635L,
13022371L, 13507596L, 13456736L, 12992393L, 12831883L, 13262301L,
12831691L, 12808893L, 12726330L, 11893457L, 12434051L, 12363464L,
12077055L, 12107221L, 11986124L, 11997087L, 12264971L, 12164412L,
12438279L, 12733842L, 12543251L, 12627134L, 12480153L, 12276238L,
12443655L, 12497753L, 12279060L, 12549138L, 12308591L, 12416680L,
12516725L, 12326545L, 12772578L, 12524848L, 13429830L, 14188044L,
16611840L, 16476565L, 15659941L, 10785585L, 12150894L, 13436366L,
12985213L, 13097555L, 13204872L, 13786040L, 13760281L, 13295389L,
14734578L, 15043941L, 14821169L, 14361765L, 14300180L, 14357964L,
14271892L, 13248168L, 13813784L, 14092489L, 14100024L, 13378374L,
13225650L, 12582444L, 13267163L, 13026181L, 12747286L, 12707074L,
12534595L, 12546094L, 13030406L, 12950360L, 12814398L, 13405187L,
13277755L, 13142375L, 12742153L, 12610817L, 12267747L, 12570075L,
12704157L, 12835948L, 12851893L, 12978880L, 13104906L, 12754018L,
13213958L, 13584642L, 13963433L, 14471672L, 16312595L, 16630000L,
16443882L, 11555299L, 12018373L, 13031876L, 13013945L, 13164137L,
13313246L, 13652605L, 13803606L, 13308310L, 14466211L, 15092736L,
15346015L, 14467260L, 14767785L, 13914271L, 14185070L, 13851028L,
13605858L, 13597999L, 13876994L, 13026270L, 13113250L, 12288727L,
12925846L, 13525010L, 12594472L, 12654512L, 12888260L), .Tsp = c(2016.00819672131,
2018.48047598209, 52.1785714285714), class = "ts")
This is how I am reading data from the csv
read_data <- read.csv(file="data.csv", header=TRUE)
data_ts <- ts(read_data, freq=365.25/7, start=decimal_date(ymd("2016-1-4")))
data <- data_ts[, 2:2]
This is the data in the csv:
Year si_act
1/4/16 12911647
1/11/16 12618317
1/18/16 12827388
1/25/16 12967840
2/1/16 13264925
2/8/16 13557838
2/15/16 13701131
2/22/16 13812463
2/29/16 13971928
3/7/16 13837658
3/14/16 13550635
3/21/16 13022371
3/28/16 13507596
4/4/16 13456736
4/11/16 12992393
4/18/16 12831883
4/25/16 13262301
5/2/16 12831691
5/9/16 12808893
5/16/16 12726330
5/23/16 11893457
5/30/16 12434051
6/6/16 12363464
6/13/16 12077055
6/20/16 12107221
6/27/16 11986124
7/4/16 11997087
7/11/16 12264971
7/18/16 12164412
7/25/16 12438279
8/1/16 12733842
8/8/16 12543251
8/15/16 12627134
8/22/16 12480153
8/29/16 12276238
9/5/16 12443655
9/12/16 12497753
9/19/16 12279060
9/26/16 12549138
10/3/16 12308591
10/10/16 12416680
10/17/16 12516725
10/24/16 12326545
10/31/16 12772578
11/7/16 12524848
11/14/16 13429830
11/21/16 14188044
11/28/16 16611840
12/5/16 16476565
12/12/16 15659941
12/19/16 10785585
12/26/16 12150894
1/2/17 13436366
1/9/17 12985213
1/16/17 13097555
1/23/17 13204872
1/30/17 13786040
2/6/17 13760281
2/13/17 13295389
2/20/17 14734578
2/27/17 15043941
3/6/17 14821169
3/13/17 14361765
3/20/17 14300180
3/27/17 14357964
4/3/17 14271892
4/10/17 13248168
4/17/17 13813784
4/24/17 14092489
5/1/17 14100024
5/8/17 13378374
5/15/17 13225650
5/22/17 12582444
5/29/17 13267163
6/5/17 13026181
6/12/17 12747286
6/19/17 12707074
6/26/17 12534595
7/3/17 12546094
7/10/17 13030406
7/17/17 12950360
7/24/17 12814398
7/31/17 13405187
8/7/17 13277755
8/14/17 13142375
8/21/17 12742153
8/28/17 12610817
9/4/17 12267747
9/11/17 12570075
9/18/17 12704157
9/25/17 12835948
10/2/17 12851893
10/9/17 12978880
10/16/17 13104906
10/23/17 12754018
10/30/17 13213958
11/6/17 13584642
11/13/17 13963433
11/20/17 14471672
11/27/17 16312595
12/4/17 16630000
12/11/17 16443882
12/18/17 11555299
12/25/17 12018373
1/1/18 13031876
1/8/18 13013945
1/15/18 13164137
1/22/18 13313246
1/29/18 13652605
2/5/18 13803606
2/12/18 13308310
2/19/18 14466211
2/26/18 15092736
3/5/18 15346015
3/12/18 14467260
3/19/18 14767785
3/26/18 13914271
4/2/18 14185070
4/9/18 13851028
4/16/18 13605858
4/23/18 13597999
4/30/18 13876994
5/7/18 13026270
5/14/18 13113250
5/21/18 12288727
5/28/18 12925846
6/4/18 13525010
6/11/18 12594472
6/18/18 12654512
6/25/18 12888260
I was able to read the data without any errors before, initially, I had 160 records & the model does not throw any error but, then for 80-20 test I removed the last 30 records and this error cropped up. Now also, if I run with all the data I don't get any error but is I run it with first 130 as 80% I get this error.
when using auto.arima with seasonal = TRUE the parameter S is not calibrated but taken from the frequency of the ts object you are providing. So in your case S = 52.17.
In case the frequency of the time series is not and integer, S is rounded to next integer so auto.arima takes S = 52.
With S=52 and a data of length 150 it becomes difficult to calibrate a seasonal arima model: e.g if P = 2 and and all other variables are zero the first 104 observations cannot be used. I guess that is what the warning is about. You are being told that the seasonal component cannot be calibrated due to the large coefficient S (or due to your short data).
So either you get a longer data history, or you aggregate your data to monthly data (such that S = 12).

Using condition in columns of data frame to generate a vector in R

I have the following array:
Year Month Day Hour
1 1 1 1 0
2 1 1 1 3
...
etc
I wrote a function which I then tried to vectorize by using apply in order to run calculations row-by-row basis, but it doesn't work due to the booleans:
day_in_season<-function(tarr){
#first month in season
if((tarr$month==12) || (tarr$month==3) ||(tarr$month==6) || (tarr$month==9)){
d=tarr$day
#second month in season
}else if ((tarr$month==1) || (tarr$month==4)){
d=31+tarr$day
}else if((tarr$month==7) || (tarr$month==10)){
d=30+tarr$day
#third month in season
}else if((tarr$month==2)){
d=62+tarr$day
}else{
d=61+tarr$day
}
h=tarr$hour/24
d=d+h
return(d)
}
I tried
apply(tdjf,1,day_in_season)
but it raised this exception:
Error in tarr$month : $ operator is invalid for atomic vectors
(I already knew about this potential pitfall, but that's why I wanted to use apply in the first place!)
The only way I can currently get it to work is if I do this:
days<-c()
for (x in 1:nrow(tdjf)){
d<-day_in_season(tdjf[x,])
days=append(days,d)
}
If there were only a few values, I'd throw up my hands and just use the for loop, efficiency be damned, but I have over 15,000 rows and that's just one dataset. I know that there has to be a way to make it work.
To vectorize your code, use ifelse() and| instead of ||:
ifelse(
(tarr$month==12) | (tarr$month==3) |(tarr$month==6) | (tarr$month==9),
tarr$day,
ifelse((tarr$month==1) | (tarr$month==4),
31+tarr$day,
ifelse((tarr$month==7) | (tarr$month==10),
30+tarr$day,
ifelse(tarr$month==2,
62+tarr$day,
61+tarr$day)
)
)
)+tarr$hour/24
You might be surprised at how quickly a well constructed for loop can run. If designed well, it has about the same efficiency of an apply statement.
The properfor loop in your case is
tdjf$days <- vector ("numeric", nrow (tdjf))
for (x in seq_along (tdjf$days)){
tdjf$days [x] <- day_in_season(tdjf[x,])
}
If you really want to go the apply route, I would recommend rewriting your function to take three arguments -- month, day, and hour -- and pass those three columns into mapply

Resources