Error in mutate_impl(.data, dots) : Evaluation error: 'from' must be a finite number












0















I have a large dataset (19945862 obs. of 3 variables) and I am building a time series model for around 50,000 members. Below is the script I am using.



memeberid  date  amount
165595 17471 2
165596 17471 1.99
165596 17471 1.29
165597 17471 0.88
...... 19945858 obs

library(sweep)
library(tidyquant)
library(forecast)
library(timetk)


yearweek <- function(x) structure(floor(52*x + .00001)/52, class = "yearweek")


reaaranging the data by week



ts$date <- as.numeric(ts$date)

weekly_amt_by_member <- ts %>%
mutate(order.week = as_date(yearweek(date))) %>%
group_by(memberid, order.week) %>%
summarise(total.amt = sum(amount))


bundleing the data on memeberid using nest()



weekly_amt_by_member_nest <- weekly_amt_by_member %>%
group_by(memberid) %>%
nest(.key = "data.tbl")


mutate and map memberid bundles and function to ts class object



weekly_amt_by_member_ts <- weekly_amt_by_member_nest %>%
mutate(data.ts = map(.x = data.tbl ,
.f = tk_ts ,
select = -order.week ,
start = 2017 ,
freq = 52))


modelling ets model



weekly_amt_by_member_fit <- weekly_amt_by_member_ts %>%
mutate(fit.ets = map(data.ts , ets))


forecasting the model



weekly_amt_by_member_fcast <- weekly_amt_by_member_fit %>%
mutate(fcast.ets = map(fit.ets , forecast , h = 52))


All the above parts are running without error except the last part (forecasting the model) which is giving me the following error:




Error in mutate_impl(.data, dots) :
Evaluation error: 'from' must be a finite number.











share|improve this question





























    0















    I have a large dataset (19945862 obs. of 3 variables) and I am building a time series model for around 50,000 members. Below is the script I am using.



    memeberid  date  amount
    165595 17471 2
    165596 17471 1.99
    165596 17471 1.29
    165597 17471 0.88
    ...... 19945858 obs

    library(sweep)
    library(tidyquant)
    library(forecast)
    library(timetk)


    yearweek <- function(x) structure(floor(52*x + .00001)/52, class = "yearweek")


    reaaranging the data by week



    ts$date <- as.numeric(ts$date)

    weekly_amt_by_member <- ts %>%
    mutate(order.week = as_date(yearweek(date))) %>%
    group_by(memberid, order.week) %>%
    summarise(total.amt = sum(amount))


    bundleing the data on memeberid using nest()



    weekly_amt_by_member_nest <- weekly_amt_by_member %>%
    group_by(memberid) %>%
    nest(.key = "data.tbl")


    mutate and map memberid bundles and function to ts class object



    weekly_amt_by_member_ts <- weekly_amt_by_member_nest %>%
    mutate(data.ts = map(.x = data.tbl ,
    .f = tk_ts ,
    select = -order.week ,
    start = 2017 ,
    freq = 52))


    modelling ets model



    weekly_amt_by_member_fit <- weekly_amt_by_member_ts %>%
    mutate(fit.ets = map(data.ts , ets))


    forecasting the model



    weekly_amt_by_member_fcast <- weekly_amt_by_member_fit %>%
    mutate(fcast.ets = map(fit.ets , forecast , h = 52))


    All the above parts are running without error except the last part (forecasting the model) which is giving me the following error:




    Error in mutate_impl(.data, dots) :
    Evaluation error: 'from' must be a finite number.











    share|improve this question



























      0












      0








      0


      1






      I have a large dataset (19945862 obs. of 3 variables) and I am building a time series model for around 50,000 members. Below is the script I am using.



      memeberid  date  amount
      165595 17471 2
      165596 17471 1.99
      165596 17471 1.29
      165597 17471 0.88
      ...... 19945858 obs

      library(sweep)
      library(tidyquant)
      library(forecast)
      library(timetk)


      yearweek <- function(x) structure(floor(52*x + .00001)/52, class = "yearweek")


      reaaranging the data by week



      ts$date <- as.numeric(ts$date)

      weekly_amt_by_member <- ts %>%
      mutate(order.week = as_date(yearweek(date))) %>%
      group_by(memberid, order.week) %>%
      summarise(total.amt = sum(amount))


      bundleing the data on memeberid using nest()



      weekly_amt_by_member_nest <- weekly_amt_by_member %>%
      group_by(memberid) %>%
      nest(.key = "data.tbl")


      mutate and map memberid bundles and function to ts class object



      weekly_amt_by_member_ts <- weekly_amt_by_member_nest %>%
      mutate(data.ts = map(.x = data.tbl ,
      .f = tk_ts ,
      select = -order.week ,
      start = 2017 ,
      freq = 52))


      modelling ets model



      weekly_amt_by_member_fit <- weekly_amt_by_member_ts %>%
      mutate(fit.ets = map(data.ts , ets))


      forecasting the model



      weekly_amt_by_member_fcast <- weekly_amt_by_member_fit %>%
      mutate(fcast.ets = map(fit.ets , forecast , h = 52))


      All the above parts are running without error except the last part (forecasting the model) which is giving me the following error:




      Error in mutate_impl(.data, dots) :
      Evaluation error: 'from' must be a finite number.











      share|improve this question
















      I have a large dataset (19945862 obs. of 3 variables) and I am building a time series model for around 50,000 members. Below is the script I am using.



      memeberid  date  amount
      165595 17471 2
      165596 17471 1.99
      165596 17471 1.29
      165597 17471 0.88
      ...... 19945858 obs

      library(sweep)
      library(tidyquant)
      library(forecast)
      library(timetk)


      yearweek <- function(x) structure(floor(52*x + .00001)/52, class = "yearweek")


      reaaranging the data by week



      ts$date <- as.numeric(ts$date)

      weekly_amt_by_member <- ts %>%
      mutate(order.week = as_date(yearweek(date))) %>%
      group_by(memberid, order.week) %>%
      summarise(total.amt = sum(amount))


      bundleing the data on memeberid using nest()



      weekly_amt_by_member_nest <- weekly_amt_by_member %>%
      group_by(memberid) %>%
      nest(.key = "data.tbl")


      mutate and map memberid bundles and function to ts class object



      weekly_amt_by_member_ts <- weekly_amt_by_member_nest %>%
      mutate(data.ts = map(.x = data.tbl ,
      .f = tk_ts ,
      select = -order.week ,
      start = 2017 ,
      freq = 52))


      modelling ets model



      weekly_amt_by_member_fit <- weekly_amt_by_member_ts %>%
      mutate(fit.ets = map(data.ts , ets))


      forecasting the model



      weekly_amt_by_member_fcast <- weekly_amt_by_member_fit %>%
      mutate(fcast.ets = map(fit.ets , forecast , h = 52))


      All the above parts are running without error except the last part (forecasting the model) which is giving me the following error:




      Error in mutate_impl(.data, dots) :
      Evaluation error: 'from' must be a finite number.








      r time-series mutate unnest






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 29 '18 at 18:39







      ABHIK ARORA

















      asked Nov 20 '18 at 22:55









      ABHIK ARORAABHIK ARORA

      63




      63
























          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
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53402820%2ferror-in-mutate-impl-data-dots-evaluation-error-from-must-be-a-finite-nu%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
















          draft saved

          draft discarded




















































          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.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53402820%2ferror-in-mutate-impl-data-dots-evaluation-error-from-must-be-a-finite-nu%23new-answer', 'question_page');
          }
          );

          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







          Popular posts from this blog

          "Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

          Alcedinidae

          Origin of the phrase “under your belt”?