boxplot time series by monthly average in rR adding infrequent date 'events' to a time series plotCreate Regular time series from an irregular (as.Date) time series with frequency=23Feeding an hourly zoo time-series into function stl()Insert rows for missing dates/timesHow to create a monthly time series with missing years?Analysing time series with seasonal effects at multiple frequenciesAverage values from a column on an hourly timeseriesConvert from annual to quarterly data, constrained to annual averagecreate a daily time series data from stock market value taking five days in a weekCreating a ts time series with missing values from a data frame
How can I get this effect? Please see the attached image
Was there a Viking Exchange as well as a Columbian one?
Who was the lone kid in the line of people at the lake at the end of Avengers: Endgame?
How would 10 generations of living underground change the human body?
Can SQL Server create collisions in system generated constraint names?
A Note on N!
Is there any official lore on the Far Realm?
Did the BCPL programming language support floats?
Initiative: Do I lose my attack/action if my target moves or dies before my turn in combat?
Pulling the rope with one hand is as heavy as with two hands?
Rivers without rain
Pre-plastic human skin alternative
Don’t seats that recline flat defeat the purpose of having seatbelts?
What are the steps to solving this definite integral?
Dynamic SOQL query relationship with field visibility for Users
How come there are so many candidates for the 2020 Democratic party presidential nomination?
How can Republicans who favour free markets, consistently express anger when they don't like the outcome of that choice?
Overlay of two functions leaves gaps
Can an Area of Effect spell cast outside a Prismatic Wall extend inside it?
Why didn't the Space Shuttle bounce back into space as many times as possible so as to lose a lot of kinetic energy up there?
Why does Mind Blank stop the Feeblemind spell?
I preordered a game on my Xbox while on the home screen of my friend's account. Which of us owns the game?
can anyone help me with this awful query plan?
How to pronounce 'c++' in Spanish
boxplot time series by monthly average in r
R adding infrequent date 'events' to a time series plotCreate Regular time series from an irregular (as.Date) time series with frequency=23Feeding an hourly zoo time-series into function stl()Insert rows for missing dates/timesHow to create a monthly time series with missing years?Analysing time series with seasonal effects at multiple frequenciesAverage values from a column on an hourly timeseriesConvert from annual to quarterly data, constrained to annual averagecreate a daily time series data from stock market value taking five days in a weekCreating a ts time series with missing values from a data frame
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I have a time series with hourly data on energy consumption in the form of a zoo object. And there are 16 indices (in the range [1:143206]) for which the Date is NA. Here is a sample of the data:
Date PJMW_MW
1 2002-04-01 01:00:00 4374
...
8709 2003-03-29 23:00:00 4827
8710 2003-03-30 00:00:00 4611
8711 2003-03-30 01:00:00 4421
8712 NA 4285
8713 2003-03-30 03:00:00 4212
8714 2003-03-30 04:00:00 4321
...
143206 2018-08-03 00:00:005489
The data above is a data.frame object called dat but I have it in a zoo object called hourly_ts:
1 4374
...
7709 6135
7710 6324
7711 6626
7712 6866
7713 6987
7714 7028
7715 7026
...
143206 5265
I would like to see the monthly averages, like, for which month is the consumption generally higher, and I saw that there is a simple formula for this: boxplot(hourly_ts ~ cycle(hourly_ts))
But the error Error in cycle.zoo(hourly_ts) : ‘x’is not regular appears.
The weird thing is that hourly_ts has a specified frequency (24 hours per day) and start time (April 1st 2002 01:00:00), so from that there shouldn't be any missing values in the time.
Supposing the missing values are what's causing the irregularity, is there a way I can add the values myself?
I would also like to use the aggregate function but have no idea what the by parameter should be.
r time-series
add a comment |
I have a time series with hourly data on energy consumption in the form of a zoo object. And there are 16 indices (in the range [1:143206]) for which the Date is NA. Here is a sample of the data:
Date PJMW_MW
1 2002-04-01 01:00:00 4374
...
8709 2003-03-29 23:00:00 4827
8710 2003-03-30 00:00:00 4611
8711 2003-03-30 01:00:00 4421
8712 NA 4285
8713 2003-03-30 03:00:00 4212
8714 2003-03-30 04:00:00 4321
...
143206 2018-08-03 00:00:005489
The data above is a data.frame object called dat but I have it in a zoo object called hourly_ts:
1 4374
...
7709 6135
7710 6324
7711 6626
7712 6866
7713 6987
7714 7028
7715 7026
...
143206 5265
I would like to see the monthly averages, like, for which month is the consumption generally higher, and I saw that there is a simple formula for this: boxplot(hourly_ts ~ cycle(hourly_ts))
But the error Error in cycle.zoo(hourly_ts) : ‘x’is not regular appears.
The weird thing is that hourly_ts has a specified frequency (24 hours per day) and start time (April 1st 2002 01:00:00), so from that there shouldn't be any missing values in the time.
Supposing the missing values are what's causing the irregularity, is there a way I can add the values myself?
I would also like to use the aggregate function but have no idea what the by parameter should be.
r time-series
could you provide a minimal data sample so the error could be reproduced?
– Oka
Mar 26 at 14:45
6 rows is too minimal?
– John Cataldo
Mar 26 at 17:00
do you get the same mistake with 6 rows?
– Oka
Mar 26 at 17:05
add a comment |
I have a time series with hourly data on energy consumption in the form of a zoo object. And there are 16 indices (in the range [1:143206]) for which the Date is NA. Here is a sample of the data:
Date PJMW_MW
1 2002-04-01 01:00:00 4374
...
8709 2003-03-29 23:00:00 4827
8710 2003-03-30 00:00:00 4611
8711 2003-03-30 01:00:00 4421
8712 NA 4285
8713 2003-03-30 03:00:00 4212
8714 2003-03-30 04:00:00 4321
...
143206 2018-08-03 00:00:005489
The data above is a data.frame object called dat but I have it in a zoo object called hourly_ts:
1 4374
...
7709 6135
7710 6324
7711 6626
7712 6866
7713 6987
7714 7028
7715 7026
...
143206 5265
I would like to see the monthly averages, like, for which month is the consumption generally higher, and I saw that there is a simple formula for this: boxplot(hourly_ts ~ cycle(hourly_ts))
But the error Error in cycle.zoo(hourly_ts) : ‘x’is not regular appears.
The weird thing is that hourly_ts has a specified frequency (24 hours per day) and start time (April 1st 2002 01:00:00), so from that there shouldn't be any missing values in the time.
Supposing the missing values are what's causing the irregularity, is there a way I can add the values myself?
I would also like to use the aggregate function but have no idea what the by parameter should be.
r time-series
I have a time series with hourly data on energy consumption in the form of a zoo object. And there are 16 indices (in the range [1:143206]) for which the Date is NA. Here is a sample of the data:
Date PJMW_MW
1 2002-04-01 01:00:00 4374
...
8709 2003-03-29 23:00:00 4827
8710 2003-03-30 00:00:00 4611
8711 2003-03-30 01:00:00 4421
8712 NA 4285
8713 2003-03-30 03:00:00 4212
8714 2003-03-30 04:00:00 4321
...
143206 2018-08-03 00:00:005489
The data above is a data.frame object called dat but I have it in a zoo object called hourly_ts:
1 4374
...
7709 6135
7710 6324
7711 6626
7712 6866
7713 6987
7714 7028
7715 7026
...
143206 5265
I would like to see the monthly averages, like, for which month is the consumption generally higher, and I saw that there is a simple formula for this: boxplot(hourly_ts ~ cycle(hourly_ts))
But the error Error in cycle.zoo(hourly_ts) : ‘x’is not regular appears.
The weird thing is that hourly_ts has a specified frequency (24 hours per day) and start time (April 1st 2002 01:00:00), so from that there shouldn't be any missing values in the time.
Supposing the missing values are what's causing the irregularity, is there a way I can add the values myself?
I would also like to use the aggregate function but have no idea what the by parameter should be.
r time-series
r time-series
edited Mar 22 at 17:36
John Cataldo
asked Mar 22 at 17:30
John CataldoJohn Cataldo
1055
1055
could you provide a minimal data sample so the error could be reproduced?
– Oka
Mar 26 at 14:45
6 rows is too minimal?
– John Cataldo
Mar 26 at 17:00
do you get the same mistake with 6 rows?
– Oka
Mar 26 at 17:05
add a comment |
could you provide a minimal data sample so the error could be reproduced?
– Oka
Mar 26 at 14:45
6 rows is too minimal?
– John Cataldo
Mar 26 at 17:00
do you get the same mistake with 6 rows?
– Oka
Mar 26 at 17:05
could you provide a minimal data sample so the error could be reproduced?
– Oka
Mar 26 at 14:45
could you provide a minimal data sample so the error could be reproduced?
– Oka
Mar 26 at 14:45
6 rows is too minimal?
– John Cataldo
Mar 26 at 17:00
6 rows is too minimal?
– John Cataldo
Mar 26 at 17:00
do you get the same mistake with 6 rows?
– Oka
Mar 26 at 17:05
do you get the same mistake with 6 rows?
– Oka
Mar 26 at 17:05
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55304953%2fboxplot-time-series-by-monthly-average-in-r%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55304953%2fboxplot-time-series-by-monthly-average-in-r%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
could you provide a minimal data sample so the error could be reproduced?
– Oka
Mar 26 at 14:45
6 rows is too minimal?
– John Cataldo
Mar 26 at 17:00
do you get the same mistake with 6 rows?
– Oka
Mar 26 at 17:05