error knitting flex dashboard rmarkdown dplyr












2















I'm getting the following error when knitting to html flex_dashboard in rmarkdown.



Error in UseMethod("mutate_") :
no applicable method for 'mutate_' applied to an object of class "function"
Calls: ... withVisible -> -> mutate -> mutate.default -> mutate_
Execution halted



It is weird to get this error as I don't see my mistake. What am I doing wrong?



---
title: "Untitled"
output:
flexdashboard::flex_dashboard:
orientation: rows
vertical_layout: fill
---

```{r setup, include = FALSE}
# --- This chunk sets the general options for compiling the final output
document with knitr

knitr::opts_chunk$set(echo = FALSE, # display code in output
warning = FALSE, # display code warnings in document
results = 'asis', # passthrough results
error = FALSE, # display error messages in document
message = FALSE, # display code messages in document
fig.align = 'center', # type of alignment of figures
eval = TRUE # evaluate code in code chunk
)
# there are more options available to tune the way the document can be compiled.

# set global options for table output in notebook when not compiled.
options(knitr.table.format = "html")
```


```{r libraries, include = FALSE}
# library loads
library(flexdashboard)
library(dygraphs)
library(dplyr)
library(lubridate)
library(xts)
library(zoo)
library(magrittr)
```

```{r dataprep, include = FALSE}
# create promodata
df %>%
mutate(promo_active = if_else((datum_besteld >= datum_start_promo &
datum_besteld <= datum_end_promo), 1, 0, missing = NULL),
weekday = weekdays(datum_besteld),
weekend = if_else(weekday == "Saturday" | weekday == "Sunday", 1, 0, missing = NULL)
)
```


extract of df:



structure(list(ktk_nr_ts = c(2.01703127263e+18, 2.01703127302e+18, 
2.01703127304e+18, 2.01703127263e+18, 2.01703127263e+18,
2.01703124599e+18,
2.01703127263e+18, 2.01807087263e+18, 2.01807087263e+18,
2.01807087263e+18,
2.01807087314e+18, 2.01807084123e+18, 2.01807084123e+18,
2018070836540006400,
2018070836540006400, 2.01807083747e+18, 2.01807083747e+18,
2.01807084121e+18,
2.01807084121e+18, 2.01807083637e+18, 2.01807084232e+18,
2.01807083829e+18,
2.01807083829e+18, 2018070841230006784, 2018070841230005760,
2.01807084121e+18, 2.01807084121e+18, 2.01807084121e+18,
2.01807087263e+18,
2.01807087263e+18), omzet = c(898, 377, 341.1, 29.95, 1899, 48.75,
349, 36.72, 12.16, 21.74, 29.95, 23.96, 23.96, 139, 19.95, 44.97,
37.46, 18.36, 44.96, 21.95, 14.95, 46.71, 89.99, 0, 166, 52.42,
35.12, 44.99, 49.95, 429), datum_besteld = structure(c(17237,
17237, 17237, 17237, 17237, 17227, 17237, 17716, 17716, 17716,
17716, 17715, 17715, 17714, 17715, 17713, 17713, 17716, 17716,
17715, 17717, 17708, 17708, 17704, 17717, 17712, 17712, 17712,
17720, 17720), class = "Date"), datum_start_promo = structure(c(2932896,
2932896, 17232, 2932896, 2932896, 2932896, 2932896, 17712, 17713,
17713, 2932896, 17712, 17712, 2932896, 2932896, 17712, 17712,
17712, 17712, 2932896, 2932896, 17687, 2932896, 2932896, 2932896,
17712, 17712, 2932896, 2932896, 2932896), class = "Date"), datum_end_promo
= structure(c(2932896,
2932896, 17253, 2932896, 2932896, 2932896, 2932896, 17743, 17727,
17727, 2932896, 17743, 17743, 2932896, 2932896, 17743, 17743,
17743, 17743, 2932896, 2932896, 17711, 2932896, 2932896, 2932896,
17743, 17743, 2932896, 2932896, 2932896), class = "Date")), row.names =
c(NA,
30L), class = "data.frame")


sessionInfo()



sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux Server 7.5 (Maipo)

Matrix products: default
BLAS: /home/AD/jbr1ftr/.conda/envs/r-jl/lib/R/lib/libRblas.so
LAPACK: /home/AD/jbr1ftr/.conda/envs/r-jl/lib/R/lib/libRlapack.so

locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] parallel stats graphics grDevices utils datasets methods base

other attached packages:
[1] bindrcpp_0.2.2 xts_0.11-0 zoo_1.8-3 dygraphs_1.1.1.6 flexdashboard_0.5.1.1 iml_0.5.1 doFuture_0.6.0
[8] iterators_1.0.10 foreach_1.5.0 future_1.9.0 kableExtra_0.9.0 knitr_1.20 ruler_0.1.3 AMR_0.2.0
[15] table1_1.1 skimr_1.0.3 descriptr_0.4.1 corrr_0.3.0 plotROC_2.2.1 pROC_1.12.1 RANN_2.6
[22] caret_6.0-80 lattice_0.20-35 magrittr_1.5 odbc_1.1.6 DBI_1.0.0 glue_1.3.0 rvest_0.3.2
[29] xml2_1.2.0 httr_1.3.1 jsonlite_1.5 forcats_0.3.0 tibble_1.4.2 ggvis_0.4.3 ggplot2_3.0.0
[36] purrr_0.2.5 stringr_1.3.1 lubridate_1.7.4 dplyr_0.7.6 tidyr_0.8.1 readr_1.1.1 readxl_1.1.0
[43] RevoUtils_11.0.1 RevoUtilsMath_11.0.0

loaded via a namespace (and not attached):
[1] colorspace_1.3-2 class_7.3-14 rprojroot_1.3-2 base64enc_0.1-3 pls_2.6-0 rstudioapi_0.7 DRR_0.0.3 listenv_0.7.0 bit64_0.9-7
[10] mvtnorm_1.0-8 prodlim_2018.04.18 codetools_0.2-15 splines_3.5.1 robustbase_0.93-2 libcoin_1.0-1 RcppRoll_0.3.0 Formula_1.2-3 Metrics_0.1.4
[19] broom_0.5.0 ddalpha_1.3.4 kernlab_0.9-26 sfsmisc_1.1-2 shiny_1.1.0 compiler_3.5.1 backports_1.1.2 assertthat_0.2.0 Matrix_1.2-14
[28] lazyeval_0.2.1 later_0.7.3 htmltools_0.3.6 tools_3.5.1 partykit_1.2-2 gtable_0.2.0 reshape2_1.4.3 Rcpp_0.12.18 cellranger_1.1.0
[37] nlme_3.1-137 inum_1.0-0 timeDate_3043.102 gower_0.1.2 globals_0.12.1 mime_0.5 DEoptimR_1.0-8 MASS_7.3-50 scales_0.5.0
[46] ipred_0.9-6 hms_0.4.2 promises_1.0.1 yaml_2.2.0 rpart_4.1-13 stringi_1.2.4 checkmate_1.8.5 lava_1.6.2 geometry_0.3-6
[55] rlang_0.2.1 pkgconfig_2.0.1 evaluate_0.11 bindr_0.1.1 htmlwidgets_1.2 recipes_0.1.3 CVST_0.2-2 bit_1.1-14 tidyselect_0.2.4
[64] plyr_1.8.4 R6_2.2.2 dimRed_0.1.0 pillar_1.3.0 withr_2.1.2 survival_2.42-3 abind_1.4-5 nnet_7.3-12 crayon_1.3.4
[73] rmarkdown_1.10 grid_3.5.1 data.table_1.11.4 blob_1.1.1 ModelMetrics_1.1.0 digest_0.6.15 xtable_1.8-2 httpuv_1.4.5 keyholder_0.1.2
[82] glmnet_2.0-16 stats4_3.5.1 munsell_0.5.0 viridisLite_0.3.0 magic_1.5-8









share|improve this question

























  • Please dput a sample of your data.

    – Christoph
    Nov 21 '18 at 8:23











  • added a dput sample

    – JL B
    Nov 21 '18 at 8:57











  • Did my answer solve your problem? Then you can mark it as such...

    – Christoph
    Nov 21 '18 at 10:04











  • yes, haven't had the time yet to test it until now. Thanks for your support!

    – JL B
    Nov 23 '18 at 8:05
















2















I'm getting the following error when knitting to html flex_dashboard in rmarkdown.



Error in UseMethod("mutate_") :
no applicable method for 'mutate_' applied to an object of class "function"
Calls: ... withVisible -> -> mutate -> mutate.default -> mutate_
Execution halted



It is weird to get this error as I don't see my mistake. What am I doing wrong?



---
title: "Untitled"
output:
flexdashboard::flex_dashboard:
orientation: rows
vertical_layout: fill
---

```{r setup, include = FALSE}
# --- This chunk sets the general options for compiling the final output
document with knitr

knitr::opts_chunk$set(echo = FALSE, # display code in output
warning = FALSE, # display code warnings in document
results = 'asis', # passthrough results
error = FALSE, # display error messages in document
message = FALSE, # display code messages in document
fig.align = 'center', # type of alignment of figures
eval = TRUE # evaluate code in code chunk
)
# there are more options available to tune the way the document can be compiled.

# set global options for table output in notebook when not compiled.
options(knitr.table.format = "html")
```


```{r libraries, include = FALSE}
# library loads
library(flexdashboard)
library(dygraphs)
library(dplyr)
library(lubridate)
library(xts)
library(zoo)
library(magrittr)
```

```{r dataprep, include = FALSE}
# create promodata
df %>%
mutate(promo_active = if_else((datum_besteld >= datum_start_promo &
datum_besteld <= datum_end_promo), 1, 0, missing = NULL),
weekday = weekdays(datum_besteld),
weekend = if_else(weekday == "Saturday" | weekday == "Sunday", 1, 0, missing = NULL)
)
```


extract of df:



structure(list(ktk_nr_ts = c(2.01703127263e+18, 2.01703127302e+18, 
2.01703127304e+18, 2.01703127263e+18, 2.01703127263e+18,
2.01703124599e+18,
2.01703127263e+18, 2.01807087263e+18, 2.01807087263e+18,
2.01807087263e+18,
2.01807087314e+18, 2.01807084123e+18, 2.01807084123e+18,
2018070836540006400,
2018070836540006400, 2.01807083747e+18, 2.01807083747e+18,
2.01807084121e+18,
2.01807084121e+18, 2.01807083637e+18, 2.01807084232e+18,
2.01807083829e+18,
2.01807083829e+18, 2018070841230006784, 2018070841230005760,
2.01807084121e+18, 2.01807084121e+18, 2.01807084121e+18,
2.01807087263e+18,
2.01807087263e+18), omzet = c(898, 377, 341.1, 29.95, 1899, 48.75,
349, 36.72, 12.16, 21.74, 29.95, 23.96, 23.96, 139, 19.95, 44.97,
37.46, 18.36, 44.96, 21.95, 14.95, 46.71, 89.99, 0, 166, 52.42,
35.12, 44.99, 49.95, 429), datum_besteld = structure(c(17237,
17237, 17237, 17237, 17237, 17227, 17237, 17716, 17716, 17716,
17716, 17715, 17715, 17714, 17715, 17713, 17713, 17716, 17716,
17715, 17717, 17708, 17708, 17704, 17717, 17712, 17712, 17712,
17720, 17720), class = "Date"), datum_start_promo = structure(c(2932896,
2932896, 17232, 2932896, 2932896, 2932896, 2932896, 17712, 17713,
17713, 2932896, 17712, 17712, 2932896, 2932896, 17712, 17712,
17712, 17712, 2932896, 2932896, 17687, 2932896, 2932896, 2932896,
17712, 17712, 2932896, 2932896, 2932896), class = "Date"), datum_end_promo
= structure(c(2932896,
2932896, 17253, 2932896, 2932896, 2932896, 2932896, 17743, 17727,
17727, 2932896, 17743, 17743, 2932896, 2932896, 17743, 17743,
17743, 17743, 2932896, 2932896, 17711, 2932896, 2932896, 2932896,
17743, 17743, 2932896, 2932896, 2932896), class = "Date")), row.names =
c(NA,
30L), class = "data.frame")


sessionInfo()



sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux Server 7.5 (Maipo)

Matrix products: default
BLAS: /home/AD/jbr1ftr/.conda/envs/r-jl/lib/R/lib/libRblas.so
LAPACK: /home/AD/jbr1ftr/.conda/envs/r-jl/lib/R/lib/libRlapack.so

locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] parallel stats graphics grDevices utils datasets methods base

other attached packages:
[1] bindrcpp_0.2.2 xts_0.11-0 zoo_1.8-3 dygraphs_1.1.1.6 flexdashboard_0.5.1.1 iml_0.5.1 doFuture_0.6.0
[8] iterators_1.0.10 foreach_1.5.0 future_1.9.0 kableExtra_0.9.0 knitr_1.20 ruler_0.1.3 AMR_0.2.0
[15] table1_1.1 skimr_1.0.3 descriptr_0.4.1 corrr_0.3.0 plotROC_2.2.1 pROC_1.12.1 RANN_2.6
[22] caret_6.0-80 lattice_0.20-35 magrittr_1.5 odbc_1.1.6 DBI_1.0.0 glue_1.3.0 rvest_0.3.2
[29] xml2_1.2.0 httr_1.3.1 jsonlite_1.5 forcats_0.3.0 tibble_1.4.2 ggvis_0.4.3 ggplot2_3.0.0
[36] purrr_0.2.5 stringr_1.3.1 lubridate_1.7.4 dplyr_0.7.6 tidyr_0.8.1 readr_1.1.1 readxl_1.1.0
[43] RevoUtils_11.0.1 RevoUtilsMath_11.0.0

loaded via a namespace (and not attached):
[1] colorspace_1.3-2 class_7.3-14 rprojroot_1.3-2 base64enc_0.1-3 pls_2.6-0 rstudioapi_0.7 DRR_0.0.3 listenv_0.7.0 bit64_0.9-7
[10] mvtnorm_1.0-8 prodlim_2018.04.18 codetools_0.2-15 splines_3.5.1 robustbase_0.93-2 libcoin_1.0-1 RcppRoll_0.3.0 Formula_1.2-3 Metrics_0.1.4
[19] broom_0.5.0 ddalpha_1.3.4 kernlab_0.9-26 sfsmisc_1.1-2 shiny_1.1.0 compiler_3.5.1 backports_1.1.2 assertthat_0.2.0 Matrix_1.2-14
[28] lazyeval_0.2.1 later_0.7.3 htmltools_0.3.6 tools_3.5.1 partykit_1.2-2 gtable_0.2.0 reshape2_1.4.3 Rcpp_0.12.18 cellranger_1.1.0
[37] nlme_3.1-137 inum_1.0-0 timeDate_3043.102 gower_0.1.2 globals_0.12.1 mime_0.5 DEoptimR_1.0-8 MASS_7.3-50 scales_0.5.0
[46] ipred_0.9-6 hms_0.4.2 promises_1.0.1 yaml_2.2.0 rpart_4.1-13 stringi_1.2.4 checkmate_1.8.5 lava_1.6.2 geometry_0.3-6
[55] rlang_0.2.1 pkgconfig_2.0.1 evaluate_0.11 bindr_0.1.1 htmlwidgets_1.2 recipes_0.1.3 CVST_0.2-2 bit_1.1-14 tidyselect_0.2.4
[64] plyr_1.8.4 R6_2.2.2 dimRed_0.1.0 pillar_1.3.0 withr_2.1.2 survival_2.42-3 abind_1.4-5 nnet_7.3-12 crayon_1.3.4
[73] rmarkdown_1.10 grid_3.5.1 data.table_1.11.4 blob_1.1.1 ModelMetrics_1.1.0 digest_0.6.15 xtable_1.8-2 httpuv_1.4.5 keyholder_0.1.2
[82] glmnet_2.0-16 stats4_3.5.1 munsell_0.5.0 viridisLite_0.3.0 magic_1.5-8









share|improve this question

























  • Please dput a sample of your data.

    – Christoph
    Nov 21 '18 at 8:23











  • added a dput sample

    – JL B
    Nov 21 '18 at 8:57











  • Did my answer solve your problem? Then you can mark it as such...

    – Christoph
    Nov 21 '18 at 10:04











  • yes, haven't had the time yet to test it until now. Thanks for your support!

    – JL B
    Nov 23 '18 at 8:05














2












2








2








I'm getting the following error when knitting to html flex_dashboard in rmarkdown.



Error in UseMethod("mutate_") :
no applicable method for 'mutate_' applied to an object of class "function"
Calls: ... withVisible -> -> mutate -> mutate.default -> mutate_
Execution halted



It is weird to get this error as I don't see my mistake. What am I doing wrong?



---
title: "Untitled"
output:
flexdashboard::flex_dashboard:
orientation: rows
vertical_layout: fill
---

```{r setup, include = FALSE}
# --- This chunk sets the general options for compiling the final output
document with knitr

knitr::opts_chunk$set(echo = FALSE, # display code in output
warning = FALSE, # display code warnings in document
results = 'asis', # passthrough results
error = FALSE, # display error messages in document
message = FALSE, # display code messages in document
fig.align = 'center', # type of alignment of figures
eval = TRUE # evaluate code in code chunk
)
# there are more options available to tune the way the document can be compiled.

# set global options for table output in notebook when not compiled.
options(knitr.table.format = "html")
```


```{r libraries, include = FALSE}
# library loads
library(flexdashboard)
library(dygraphs)
library(dplyr)
library(lubridate)
library(xts)
library(zoo)
library(magrittr)
```

```{r dataprep, include = FALSE}
# create promodata
df %>%
mutate(promo_active = if_else((datum_besteld >= datum_start_promo &
datum_besteld <= datum_end_promo), 1, 0, missing = NULL),
weekday = weekdays(datum_besteld),
weekend = if_else(weekday == "Saturday" | weekday == "Sunday", 1, 0, missing = NULL)
)
```


extract of df:



structure(list(ktk_nr_ts = c(2.01703127263e+18, 2.01703127302e+18, 
2.01703127304e+18, 2.01703127263e+18, 2.01703127263e+18,
2.01703124599e+18,
2.01703127263e+18, 2.01807087263e+18, 2.01807087263e+18,
2.01807087263e+18,
2.01807087314e+18, 2.01807084123e+18, 2.01807084123e+18,
2018070836540006400,
2018070836540006400, 2.01807083747e+18, 2.01807083747e+18,
2.01807084121e+18,
2.01807084121e+18, 2.01807083637e+18, 2.01807084232e+18,
2.01807083829e+18,
2.01807083829e+18, 2018070841230006784, 2018070841230005760,
2.01807084121e+18, 2.01807084121e+18, 2.01807084121e+18,
2.01807087263e+18,
2.01807087263e+18), omzet = c(898, 377, 341.1, 29.95, 1899, 48.75,
349, 36.72, 12.16, 21.74, 29.95, 23.96, 23.96, 139, 19.95, 44.97,
37.46, 18.36, 44.96, 21.95, 14.95, 46.71, 89.99, 0, 166, 52.42,
35.12, 44.99, 49.95, 429), datum_besteld = structure(c(17237,
17237, 17237, 17237, 17237, 17227, 17237, 17716, 17716, 17716,
17716, 17715, 17715, 17714, 17715, 17713, 17713, 17716, 17716,
17715, 17717, 17708, 17708, 17704, 17717, 17712, 17712, 17712,
17720, 17720), class = "Date"), datum_start_promo = structure(c(2932896,
2932896, 17232, 2932896, 2932896, 2932896, 2932896, 17712, 17713,
17713, 2932896, 17712, 17712, 2932896, 2932896, 17712, 17712,
17712, 17712, 2932896, 2932896, 17687, 2932896, 2932896, 2932896,
17712, 17712, 2932896, 2932896, 2932896), class = "Date"), datum_end_promo
= structure(c(2932896,
2932896, 17253, 2932896, 2932896, 2932896, 2932896, 17743, 17727,
17727, 2932896, 17743, 17743, 2932896, 2932896, 17743, 17743,
17743, 17743, 2932896, 2932896, 17711, 2932896, 2932896, 2932896,
17743, 17743, 2932896, 2932896, 2932896), class = "Date")), row.names =
c(NA,
30L), class = "data.frame")


sessionInfo()



sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux Server 7.5 (Maipo)

Matrix products: default
BLAS: /home/AD/jbr1ftr/.conda/envs/r-jl/lib/R/lib/libRblas.so
LAPACK: /home/AD/jbr1ftr/.conda/envs/r-jl/lib/R/lib/libRlapack.so

locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] parallel stats graphics grDevices utils datasets methods base

other attached packages:
[1] bindrcpp_0.2.2 xts_0.11-0 zoo_1.8-3 dygraphs_1.1.1.6 flexdashboard_0.5.1.1 iml_0.5.1 doFuture_0.6.0
[8] iterators_1.0.10 foreach_1.5.0 future_1.9.0 kableExtra_0.9.0 knitr_1.20 ruler_0.1.3 AMR_0.2.0
[15] table1_1.1 skimr_1.0.3 descriptr_0.4.1 corrr_0.3.0 plotROC_2.2.1 pROC_1.12.1 RANN_2.6
[22] caret_6.0-80 lattice_0.20-35 magrittr_1.5 odbc_1.1.6 DBI_1.0.0 glue_1.3.0 rvest_0.3.2
[29] xml2_1.2.0 httr_1.3.1 jsonlite_1.5 forcats_0.3.0 tibble_1.4.2 ggvis_0.4.3 ggplot2_3.0.0
[36] purrr_0.2.5 stringr_1.3.1 lubridate_1.7.4 dplyr_0.7.6 tidyr_0.8.1 readr_1.1.1 readxl_1.1.0
[43] RevoUtils_11.0.1 RevoUtilsMath_11.0.0

loaded via a namespace (and not attached):
[1] colorspace_1.3-2 class_7.3-14 rprojroot_1.3-2 base64enc_0.1-3 pls_2.6-0 rstudioapi_0.7 DRR_0.0.3 listenv_0.7.0 bit64_0.9-7
[10] mvtnorm_1.0-8 prodlim_2018.04.18 codetools_0.2-15 splines_3.5.1 robustbase_0.93-2 libcoin_1.0-1 RcppRoll_0.3.0 Formula_1.2-3 Metrics_0.1.4
[19] broom_0.5.0 ddalpha_1.3.4 kernlab_0.9-26 sfsmisc_1.1-2 shiny_1.1.0 compiler_3.5.1 backports_1.1.2 assertthat_0.2.0 Matrix_1.2-14
[28] lazyeval_0.2.1 later_0.7.3 htmltools_0.3.6 tools_3.5.1 partykit_1.2-2 gtable_0.2.0 reshape2_1.4.3 Rcpp_0.12.18 cellranger_1.1.0
[37] nlme_3.1-137 inum_1.0-0 timeDate_3043.102 gower_0.1.2 globals_0.12.1 mime_0.5 DEoptimR_1.0-8 MASS_7.3-50 scales_0.5.0
[46] ipred_0.9-6 hms_0.4.2 promises_1.0.1 yaml_2.2.0 rpart_4.1-13 stringi_1.2.4 checkmate_1.8.5 lava_1.6.2 geometry_0.3-6
[55] rlang_0.2.1 pkgconfig_2.0.1 evaluate_0.11 bindr_0.1.1 htmlwidgets_1.2 recipes_0.1.3 CVST_0.2-2 bit_1.1-14 tidyselect_0.2.4
[64] plyr_1.8.4 R6_2.2.2 dimRed_0.1.0 pillar_1.3.0 withr_2.1.2 survival_2.42-3 abind_1.4-5 nnet_7.3-12 crayon_1.3.4
[73] rmarkdown_1.10 grid_3.5.1 data.table_1.11.4 blob_1.1.1 ModelMetrics_1.1.0 digest_0.6.15 xtable_1.8-2 httpuv_1.4.5 keyholder_0.1.2
[82] glmnet_2.0-16 stats4_3.5.1 munsell_0.5.0 viridisLite_0.3.0 magic_1.5-8









share|improve this question
















I'm getting the following error when knitting to html flex_dashboard in rmarkdown.



Error in UseMethod("mutate_") :
no applicable method for 'mutate_' applied to an object of class "function"
Calls: ... withVisible -> -> mutate -> mutate.default -> mutate_
Execution halted



It is weird to get this error as I don't see my mistake. What am I doing wrong?



---
title: "Untitled"
output:
flexdashboard::flex_dashboard:
orientation: rows
vertical_layout: fill
---

```{r setup, include = FALSE}
# --- This chunk sets the general options for compiling the final output
document with knitr

knitr::opts_chunk$set(echo = FALSE, # display code in output
warning = FALSE, # display code warnings in document
results = 'asis', # passthrough results
error = FALSE, # display error messages in document
message = FALSE, # display code messages in document
fig.align = 'center', # type of alignment of figures
eval = TRUE # evaluate code in code chunk
)
# there are more options available to tune the way the document can be compiled.

# set global options for table output in notebook when not compiled.
options(knitr.table.format = "html")
```


```{r libraries, include = FALSE}
# library loads
library(flexdashboard)
library(dygraphs)
library(dplyr)
library(lubridate)
library(xts)
library(zoo)
library(magrittr)
```

```{r dataprep, include = FALSE}
# create promodata
df %>%
mutate(promo_active = if_else((datum_besteld >= datum_start_promo &
datum_besteld <= datum_end_promo), 1, 0, missing = NULL),
weekday = weekdays(datum_besteld),
weekend = if_else(weekday == "Saturday" | weekday == "Sunday", 1, 0, missing = NULL)
)
```


extract of df:



structure(list(ktk_nr_ts = c(2.01703127263e+18, 2.01703127302e+18, 
2.01703127304e+18, 2.01703127263e+18, 2.01703127263e+18,
2.01703124599e+18,
2.01703127263e+18, 2.01807087263e+18, 2.01807087263e+18,
2.01807087263e+18,
2.01807087314e+18, 2.01807084123e+18, 2.01807084123e+18,
2018070836540006400,
2018070836540006400, 2.01807083747e+18, 2.01807083747e+18,
2.01807084121e+18,
2.01807084121e+18, 2.01807083637e+18, 2.01807084232e+18,
2.01807083829e+18,
2.01807083829e+18, 2018070841230006784, 2018070841230005760,
2.01807084121e+18, 2.01807084121e+18, 2.01807084121e+18,
2.01807087263e+18,
2.01807087263e+18), omzet = c(898, 377, 341.1, 29.95, 1899, 48.75,
349, 36.72, 12.16, 21.74, 29.95, 23.96, 23.96, 139, 19.95, 44.97,
37.46, 18.36, 44.96, 21.95, 14.95, 46.71, 89.99, 0, 166, 52.42,
35.12, 44.99, 49.95, 429), datum_besteld = structure(c(17237,
17237, 17237, 17237, 17237, 17227, 17237, 17716, 17716, 17716,
17716, 17715, 17715, 17714, 17715, 17713, 17713, 17716, 17716,
17715, 17717, 17708, 17708, 17704, 17717, 17712, 17712, 17712,
17720, 17720), class = "Date"), datum_start_promo = structure(c(2932896,
2932896, 17232, 2932896, 2932896, 2932896, 2932896, 17712, 17713,
17713, 2932896, 17712, 17712, 2932896, 2932896, 17712, 17712,
17712, 17712, 2932896, 2932896, 17687, 2932896, 2932896, 2932896,
17712, 17712, 2932896, 2932896, 2932896), class = "Date"), datum_end_promo
= structure(c(2932896,
2932896, 17253, 2932896, 2932896, 2932896, 2932896, 17743, 17727,
17727, 2932896, 17743, 17743, 2932896, 2932896, 17743, 17743,
17743, 17743, 2932896, 2932896, 17711, 2932896, 2932896, 2932896,
17743, 17743, 2932896, 2932896, 2932896), class = "Date")), row.names =
c(NA,
30L), class = "data.frame")


sessionInfo()



sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux Server 7.5 (Maipo)

Matrix products: default
BLAS: /home/AD/jbr1ftr/.conda/envs/r-jl/lib/R/lib/libRblas.so
LAPACK: /home/AD/jbr1ftr/.conda/envs/r-jl/lib/R/lib/libRlapack.so

locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] parallel stats graphics grDevices utils datasets methods base

other attached packages:
[1] bindrcpp_0.2.2 xts_0.11-0 zoo_1.8-3 dygraphs_1.1.1.6 flexdashboard_0.5.1.1 iml_0.5.1 doFuture_0.6.0
[8] iterators_1.0.10 foreach_1.5.0 future_1.9.0 kableExtra_0.9.0 knitr_1.20 ruler_0.1.3 AMR_0.2.0
[15] table1_1.1 skimr_1.0.3 descriptr_0.4.1 corrr_0.3.0 plotROC_2.2.1 pROC_1.12.1 RANN_2.6
[22] caret_6.0-80 lattice_0.20-35 magrittr_1.5 odbc_1.1.6 DBI_1.0.0 glue_1.3.0 rvest_0.3.2
[29] xml2_1.2.0 httr_1.3.1 jsonlite_1.5 forcats_0.3.0 tibble_1.4.2 ggvis_0.4.3 ggplot2_3.0.0
[36] purrr_0.2.5 stringr_1.3.1 lubridate_1.7.4 dplyr_0.7.6 tidyr_0.8.1 readr_1.1.1 readxl_1.1.0
[43] RevoUtils_11.0.1 RevoUtilsMath_11.0.0

loaded via a namespace (and not attached):
[1] colorspace_1.3-2 class_7.3-14 rprojroot_1.3-2 base64enc_0.1-3 pls_2.6-0 rstudioapi_0.7 DRR_0.0.3 listenv_0.7.0 bit64_0.9-7
[10] mvtnorm_1.0-8 prodlim_2018.04.18 codetools_0.2-15 splines_3.5.1 robustbase_0.93-2 libcoin_1.0-1 RcppRoll_0.3.0 Formula_1.2-3 Metrics_0.1.4
[19] broom_0.5.0 ddalpha_1.3.4 kernlab_0.9-26 sfsmisc_1.1-2 shiny_1.1.0 compiler_3.5.1 backports_1.1.2 assertthat_0.2.0 Matrix_1.2-14
[28] lazyeval_0.2.1 later_0.7.3 htmltools_0.3.6 tools_3.5.1 partykit_1.2-2 gtable_0.2.0 reshape2_1.4.3 Rcpp_0.12.18 cellranger_1.1.0
[37] nlme_3.1-137 inum_1.0-0 timeDate_3043.102 gower_0.1.2 globals_0.12.1 mime_0.5 DEoptimR_1.0-8 MASS_7.3-50 scales_0.5.0
[46] ipred_0.9-6 hms_0.4.2 promises_1.0.1 yaml_2.2.0 rpart_4.1-13 stringi_1.2.4 checkmate_1.8.5 lava_1.6.2 geometry_0.3-6
[55] rlang_0.2.1 pkgconfig_2.0.1 evaluate_0.11 bindr_0.1.1 htmlwidgets_1.2 recipes_0.1.3 CVST_0.2-2 bit_1.1-14 tidyselect_0.2.4
[64] plyr_1.8.4 R6_2.2.2 dimRed_0.1.0 pillar_1.3.0 withr_2.1.2 survival_2.42-3 abind_1.4-5 nnet_7.3-12 crayon_1.3.4
[73] rmarkdown_1.10 grid_3.5.1 data.table_1.11.4 blob_1.1.1 ModelMetrics_1.1.0 digest_0.6.15 xtable_1.8-2 httpuv_1.4.5 keyholder_0.1.2
[82] glmnet_2.0-16 stats4_3.5.1 munsell_0.5.0 viridisLite_0.3.0 magic_1.5-8






r dplyr r-markdown knitr






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 21 '18 at 8:54







JL B

















asked Nov 21 '18 at 8:11









JL BJL B

395




395













  • Please dput a sample of your data.

    – Christoph
    Nov 21 '18 at 8:23











  • added a dput sample

    – JL B
    Nov 21 '18 at 8:57











  • Did my answer solve your problem? Then you can mark it as such...

    – Christoph
    Nov 21 '18 at 10:04











  • yes, haven't had the time yet to test it until now. Thanks for your support!

    – JL B
    Nov 23 '18 at 8:05



















  • Please dput a sample of your data.

    – Christoph
    Nov 21 '18 at 8:23











  • added a dput sample

    – JL B
    Nov 21 '18 at 8:57











  • Did my answer solve your problem? Then you can mark it as such...

    – Christoph
    Nov 21 '18 at 10:04











  • yes, haven't had the time yet to test it until now. Thanks for your support!

    – JL B
    Nov 23 '18 at 8:05

















Please dput a sample of your data.

– Christoph
Nov 21 '18 at 8:23





Please dput a sample of your data.

– Christoph
Nov 21 '18 at 8:23













added a dput sample

– JL B
Nov 21 '18 at 8:57





added a dput sample

– JL B
Nov 21 '18 at 8:57













Did my answer solve your problem? Then you can mark it as such...

– Christoph
Nov 21 '18 at 10:04





Did my answer solve your problem? Then you can mark it as such...

– Christoph
Nov 21 '18 at 10:04













yes, haven't had the time yet to test it until now. Thanks for your support!

– JL B
Nov 23 '18 at 8:05





yes, haven't had the time yet to test it until now. Thanks for your support!

– JL B
Nov 23 '18 at 8:05












2 Answers
2






active

oldest

votes


















1














I am not sure, but I guess, you forgot to include df in your file? The following scripted saved as test.Rmd worked in my case:



---
title: "Untitled"
output:
flexdashboard::flex_dashboard:
orientation: rows
vertical_layout: fill
---

```{r setup, include = FALSE}
knitr::opts_chunk$set(echo = FALSE, # display code in output
warning = FALSE, # display code warnings in document
results = 'asis', # passthrough results
error = FALSE, # display error messages in document
message = FALSE, # display code messages in document
fig.align = 'center', # type of alignment of figures
eval = TRUE # evaluate code in code chunk
)
# there are more options available to tune the way the document can be compiled.

# set global options for table output in notebook when not compiled.
options(knitr.table.format = "html")
```


```{r libraries, include = FALSE}
# library loads
library(flexdashboard)
library(dygraphs)
library(dplyr)
library(lubridate)
library(xts)
library(zoo)
library(magrittr)
```

```{r dataprep, include = FALSE}
df <- structure(list(ktk_nr_ts = c(2.01703127263e+18, 2.01703127302e+18,
2.01703127304e+18, 2.01703127263e+18, 2.01703127263e+18,
2.01703124599e+18,
2.01703127263e+18, 2.01807087263e+18, 2.01807087263e+18,
2.01807087263e+18,
2.01807087314e+18, 2.01807084123e+18, 2.01807084123e+18,
2018070836540006400,
2018070836540006400, 2.01807083747e+18, 2.01807083747e+18,
2.01807084121e+18,
2.01807084121e+18, 2.01807083637e+18, 2.01807084232e+18,
2.01807083829e+18,
2.01807083829e+18, 2018070841230006784, 2018070841230005760,
2.01807084121e+18, 2.01807084121e+18, 2.01807084121e+18,
2.01807087263e+18,
2.01807087263e+18), omzet = c(898, 377, 341.1, 29.95, 1899, 48.75,
349, 36.72, 12.16, 21.74, 29.95, 23.96, 23.96, 139, 19.95, 44.97,
37.46, 18.36, 44.96, 21.95, 14.95, 46.71, 89.99, 0, 166, 52.42,
35.12, 44.99, 49.95, 429), datum_besteld = structure(c(17237,
17237, 17237, 17237, 17237, 17227, 17237, 17716, 17716, 17716,
17716, 17715, 17715, 17714, 17715, 17713, 17713, 17716, 17716,
17715, 17717, 17708, 17708, 17704, 17717, 17712, 17712, 17712,
17720, 17720), class = "Date"), datum_start_promo = structure(c(2932896,
2932896, 17232, 2932896, 2932896, 2932896, 2932896, 17712, 17713,
17713, 2932896, 17712, 17712, 2932896, 2932896, 17712, 17712,
17712, 17712, 2932896, 2932896, 17687, 2932896, 2932896, 2932896,
17712, 17712, 2932896, 2932896, 2932896), class = "Date"), datum_end_promo
= structure(c(2932896,
2932896, 17253, 2932896, 2932896, 2932896, 2932896, 17743, 17727,
17727, 2932896, 17743, 17743, 2932896, 2932896, 17743, 17743,
17743, 17743, 2932896, 2932896, 17711, 2932896, 2932896, 2932896,
17743, 17743, 2932896, 2932896, 2932896), class = "Date")), row.names =
c(NA,
30L), class = "data.frame")

df %>%
mutate(promo_active = if_else((datum_besteld >= datum_start_promo &
datum_besteld <= datum_end_promo), 1, 0, missing = NULL),
weekday = weekdays(datum_besteld),
weekend = if_else(weekday == "Saturday" | weekday == "Sunday", 1, 0, missing = NULL)
)
```


Important Note: Rmd's are really bad to debug. If you still face problems, just run the code line by line in console.






share|improve this answer































    0














    can u try the below code once



    ```{r include = FALSE}
    # create promodata
    df2<-df %>%
    mutate(promo_active = if_else((datum_besteld >= datum_start_promo &
    datum_besteld <= datum_end_promo), 1, 0, missing = NULL),
    weekday = weekdays(datum_besteld),
    weekend = if_else(weekday == "Saturday" | weekday == "Sunday", 1, 0, missing = NULL)
    )

    df2
    ```





    share|improve this answer
























    • hi, thank you for your reply and time. It did not work. The error is the same

      – JL B
      Nov 21 '18 at 8:56













    • is it worked? update if it worked?

      – sai saran
      Nov 21 '18 at 8:56











    • it did not work

      – JL B
      Nov 21 '18 at 9:01











    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%2f53407695%2ferror-knitting-flex-dashboard-rmarkdown-dplyr%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    I am not sure, but I guess, you forgot to include df in your file? The following scripted saved as test.Rmd worked in my case:



    ---
    title: "Untitled"
    output:
    flexdashboard::flex_dashboard:
    orientation: rows
    vertical_layout: fill
    ---

    ```{r setup, include = FALSE}
    knitr::opts_chunk$set(echo = FALSE, # display code in output
    warning = FALSE, # display code warnings in document
    results = 'asis', # passthrough results
    error = FALSE, # display error messages in document
    message = FALSE, # display code messages in document
    fig.align = 'center', # type of alignment of figures
    eval = TRUE # evaluate code in code chunk
    )
    # there are more options available to tune the way the document can be compiled.

    # set global options for table output in notebook when not compiled.
    options(knitr.table.format = "html")
    ```


    ```{r libraries, include = FALSE}
    # library loads
    library(flexdashboard)
    library(dygraphs)
    library(dplyr)
    library(lubridate)
    library(xts)
    library(zoo)
    library(magrittr)
    ```

    ```{r dataprep, include = FALSE}
    df <- structure(list(ktk_nr_ts = c(2.01703127263e+18, 2.01703127302e+18,
    2.01703127304e+18, 2.01703127263e+18, 2.01703127263e+18,
    2.01703124599e+18,
    2.01703127263e+18, 2.01807087263e+18, 2.01807087263e+18,
    2.01807087263e+18,
    2.01807087314e+18, 2.01807084123e+18, 2.01807084123e+18,
    2018070836540006400,
    2018070836540006400, 2.01807083747e+18, 2.01807083747e+18,
    2.01807084121e+18,
    2.01807084121e+18, 2.01807083637e+18, 2.01807084232e+18,
    2.01807083829e+18,
    2.01807083829e+18, 2018070841230006784, 2018070841230005760,
    2.01807084121e+18, 2.01807084121e+18, 2.01807084121e+18,
    2.01807087263e+18,
    2.01807087263e+18), omzet = c(898, 377, 341.1, 29.95, 1899, 48.75,
    349, 36.72, 12.16, 21.74, 29.95, 23.96, 23.96, 139, 19.95, 44.97,
    37.46, 18.36, 44.96, 21.95, 14.95, 46.71, 89.99, 0, 166, 52.42,
    35.12, 44.99, 49.95, 429), datum_besteld = structure(c(17237,
    17237, 17237, 17237, 17237, 17227, 17237, 17716, 17716, 17716,
    17716, 17715, 17715, 17714, 17715, 17713, 17713, 17716, 17716,
    17715, 17717, 17708, 17708, 17704, 17717, 17712, 17712, 17712,
    17720, 17720), class = "Date"), datum_start_promo = structure(c(2932896,
    2932896, 17232, 2932896, 2932896, 2932896, 2932896, 17712, 17713,
    17713, 2932896, 17712, 17712, 2932896, 2932896, 17712, 17712,
    17712, 17712, 2932896, 2932896, 17687, 2932896, 2932896, 2932896,
    17712, 17712, 2932896, 2932896, 2932896), class = "Date"), datum_end_promo
    = structure(c(2932896,
    2932896, 17253, 2932896, 2932896, 2932896, 2932896, 17743, 17727,
    17727, 2932896, 17743, 17743, 2932896, 2932896, 17743, 17743,
    17743, 17743, 2932896, 2932896, 17711, 2932896, 2932896, 2932896,
    17743, 17743, 2932896, 2932896, 2932896), class = "Date")), row.names =
    c(NA,
    30L), class = "data.frame")

    df %>%
    mutate(promo_active = if_else((datum_besteld >= datum_start_promo &
    datum_besteld <= datum_end_promo), 1, 0, missing = NULL),
    weekday = weekdays(datum_besteld),
    weekend = if_else(weekday == "Saturday" | weekday == "Sunday", 1, 0, missing = NULL)
    )
    ```


    Important Note: Rmd's are really bad to debug. If you still face problems, just run the code line by line in console.






    share|improve this answer




























      1














      I am not sure, but I guess, you forgot to include df in your file? The following scripted saved as test.Rmd worked in my case:



      ---
      title: "Untitled"
      output:
      flexdashboard::flex_dashboard:
      orientation: rows
      vertical_layout: fill
      ---

      ```{r setup, include = FALSE}
      knitr::opts_chunk$set(echo = FALSE, # display code in output
      warning = FALSE, # display code warnings in document
      results = 'asis', # passthrough results
      error = FALSE, # display error messages in document
      message = FALSE, # display code messages in document
      fig.align = 'center', # type of alignment of figures
      eval = TRUE # evaluate code in code chunk
      )
      # there are more options available to tune the way the document can be compiled.

      # set global options for table output in notebook when not compiled.
      options(knitr.table.format = "html")
      ```


      ```{r libraries, include = FALSE}
      # library loads
      library(flexdashboard)
      library(dygraphs)
      library(dplyr)
      library(lubridate)
      library(xts)
      library(zoo)
      library(magrittr)
      ```

      ```{r dataprep, include = FALSE}
      df <- structure(list(ktk_nr_ts = c(2.01703127263e+18, 2.01703127302e+18,
      2.01703127304e+18, 2.01703127263e+18, 2.01703127263e+18,
      2.01703124599e+18,
      2.01703127263e+18, 2.01807087263e+18, 2.01807087263e+18,
      2.01807087263e+18,
      2.01807087314e+18, 2.01807084123e+18, 2.01807084123e+18,
      2018070836540006400,
      2018070836540006400, 2.01807083747e+18, 2.01807083747e+18,
      2.01807084121e+18,
      2.01807084121e+18, 2.01807083637e+18, 2.01807084232e+18,
      2.01807083829e+18,
      2.01807083829e+18, 2018070841230006784, 2018070841230005760,
      2.01807084121e+18, 2.01807084121e+18, 2.01807084121e+18,
      2.01807087263e+18,
      2.01807087263e+18), omzet = c(898, 377, 341.1, 29.95, 1899, 48.75,
      349, 36.72, 12.16, 21.74, 29.95, 23.96, 23.96, 139, 19.95, 44.97,
      37.46, 18.36, 44.96, 21.95, 14.95, 46.71, 89.99, 0, 166, 52.42,
      35.12, 44.99, 49.95, 429), datum_besteld = structure(c(17237,
      17237, 17237, 17237, 17237, 17227, 17237, 17716, 17716, 17716,
      17716, 17715, 17715, 17714, 17715, 17713, 17713, 17716, 17716,
      17715, 17717, 17708, 17708, 17704, 17717, 17712, 17712, 17712,
      17720, 17720), class = "Date"), datum_start_promo = structure(c(2932896,
      2932896, 17232, 2932896, 2932896, 2932896, 2932896, 17712, 17713,
      17713, 2932896, 17712, 17712, 2932896, 2932896, 17712, 17712,
      17712, 17712, 2932896, 2932896, 17687, 2932896, 2932896, 2932896,
      17712, 17712, 2932896, 2932896, 2932896), class = "Date"), datum_end_promo
      = structure(c(2932896,
      2932896, 17253, 2932896, 2932896, 2932896, 2932896, 17743, 17727,
      17727, 2932896, 17743, 17743, 2932896, 2932896, 17743, 17743,
      17743, 17743, 2932896, 2932896, 17711, 2932896, 2932896, 2932896,
      17743, 17743, 2932896, 2932896, 2932896), class = "Date")), row.names =
      c(NA,
      30L), class = "data.frame")

      df %>%
      mutate(promo_active = if_else((datum_besteld >= datum_start_promo &
      datum_besteld <= datum_end_promo), 1, 0, missing = NULL),
      weekday = weekdays(datum_besteld),
      weekend = if_else(weekday == "Saturday" | weekday == "Sunday", 1, 0, missing = NULL)
      )
      ```


      Important Note: Rmd's are really bad to debug. If you still face problems, just run the code line by line in console.






      share|improve this answer


























        1












        1








        1







        I am not sure, but I guess, you forgot to include df in your file? The following scripted saved as test.Rmd worked in my case:



        ---
        title: "Untitled"
        output:
        flexdashboard::flex_dashboard:
        orientation: rows
        vertical_layout: fill
        ---

        ```{r setup, include = FALSE}
        knitr::opts_chunk$set(echo = FALSE, # display code in output
        warning = FALSE, # display code warnings in document
        results = 'asis', # passthrough results
        error = FALSE, # display error messages in document
        message = FALSE, # display code messages in document
        fig.align = 'center', # type of alignment of figures
        eval = TRUE # evaluate code in code chunk
        )
        # there are more options available to tune the way the document can be compiled.

        # set global options for table output in notebook when not compiled.
        options(knitr.table.format = "html")
        ```


        ```{r libraries, include = FALSE}
        # library loads
        library(flexdashboard)
        library(dygraphs)
        library(dplyr)
        library(lubridate)
        library(xts)
        library(zoo)
        library(magrittr)
        ```

        ```{r dataprep, include = FALSE}
        df <- structure(list(ktk_nr_ts = c(2.01703127263e+18, 2.01703127302e+18,
        2.01703127304e+18, 2.01703127263e+18, 2.01703127263e+18,
        2.01703124599e+18,
        2.01703127263e+18, 2.01807087263e+18, 2.01807087263e+18,
        2.01807087263e+18,
        2.01807087314e+18, 2.01807084123e+18, 2.01807084123e+18,
        2018070836540006400,
        2018070836540006400, 2.01807083747e+18, 2.01807083747e+18,
        2.01807084121e+18,
        2.01807084121e+18, 2.01807083637e+18, 2.01807084232e+18,
        2.01807083829e+18,
        2.01807083829e+18, 2018070841230006784, 2018070841230005760,
        2.01807084121e+18, 2.01807084121e+18, 2.01807084121e+18,
        2.01807087263e+18,
        2.01807087263e+18), omzet = c(898, 377, 341.1, 29.95, 1899, 48.75,
        349, 36.72, 12.16, 21.74, 29.95, 23.96, 23.96, 139, 19.95, 44.97,
        37.46, 18.36, 44.96, 21.95, 14.95, 46.71, 89.99, 0, 166, 52.42,
        35.12, 44.99, 49.95, 429), datum_besteld = structure(c(17237,
        17237, 17237, 17237, 17237, 17227, 17237, 17716, 17716, 17716,
        17716, 17715, 17715, 17714, 17715, 17713, 17713, 17716, 17716,
        17715, 17717, 17708, 17708, 17704, 17717, 17712, 17712, 17712,
        17720, 17720), class = "Date"), datum_start_promo = structure(c(2932896,
        2932896, 17232, 2932896, 2932896, 2932896, 2932896, 17712, 17713,
        17713, 2932896, 17712, 17712, 2932896, 2932896, 17712, 17712,
        17712, 17712, 2932896, 2932896, 17687, 2932896, 2932896, 2932896,
        17712, 17712, 2932896, 2932896, 2932896), class = "Date"), datum_end_promo
        = structure(c(2932896,
        2932896, 17253, 2932896, 2932896, 2932896, 2932896, 17743, 17727,
        17727, 2932896, 17743, 17743, 2932896, 2932896, 17743, 17743,
        17743, 17743, 2932896, 2932896, 17711, 2932896, 2932896, 2932896,
        17743, 17743, 2932896, 2932896, 2932896), class = "Date")), row.names =
        c(NA,
        30L), class = "data.frame")

        df %>%
        mutate(promo_active = if_else((datum_besteld >= datum_start_promo &
        datum_besteld <= datum_end_promo), 1, 0, missing = NULL),
        weekday = weekdays(datum_besteld),
        weekend = if_else(weekday == "Saturday" | weekday == "Sunday", 1, 0, missing = NULL)
        )
        ```


        Important Note: Rmd's are really bad to debug. If you still face problems, just run the code line by line in console.






        share|improve this answer













        I am not sure, but I guess, you forgot to include df in your file? The following scripted saved as test.Rmd worked in my case:



        ---
        title: "Untitled"
        output:
        flexdashboard::flex_dashboard:
        orientation: rows
        vertical_layout: fill
        ---

        ```{r setup, include = FALSE}
        knitr::opts_chunk$set(echo = FALSE, # display code in output
        warning = FALSE, # display code warnings in document
        results = 'asis', # passthrough results
        error = FALSE, # display error messages in document
        message = FALSE, # display code messages in document
        fig.align = 'center', # type of alignment of figures
        eval = TRUE # evaluate code in code chunk
        )
        # there are more options available to tune the way the document can be compiled.

        # set global options for table output in notebook when not compiled.
        options(knitr.table.format = "html")
        ```


        ```{r libraries, include = FALSE}
        # library loads
        library(flexdashboard)
        library(dygraphs)
        library(dplyr)
        library(lubridate)
        library(xts)
        library(zoo)
        library(magrittr)
        ```

        ```{r dataprep, include = FALSE}
        df <- structure(list(ktk_nr_ts = c(2.01703127263e+18, 2.01703127302e+18,
        2.01703127304e+18, 2.01703127263e+18, 2.01703127263e+18,
        2.01703124599e+18,
        2.01703127263e+18, 2.01807087263e+18, 2.01807087263e+18,
        2.01807087263e+18,
        2.01807087314e+18, 2.01807084123e+18, 2.01807084123e+18,
        2018070836540006400,
        2018070836540006400, 2.01807083747e+18, 2.01807083747e+18,
        2.01807084121e+18,
        2.01807084121e+18, 2.01807083637e+18, 2.01807084232e+18,
        2.01807083829e+18,
        2.01807083829e+18, 2018070841230006784, 2018070841230005760,
        2.01807084121e+18, 2.01807084121e+18, 2.01807084121e+18,
        2.01807087263e+18,
        2.01807087263e+18), omzet = c(898, 377, 341.1, 29.95, 1899, 48.75,
        349, 36.72, 12.16, 21.74, 29.95, 23.96, 23.96, 139, 19.95, 44.97,
        37.46, 18.36, 44.96, 21.95, 14.95, 46.71, 89.99, 0, 166, 52.42,
        35.12, 44.99, 49.95, 429), datum_besteld = structure(c(17237,
        17237, 17237, 17237, 17237, 17227, 17237, 17716, 17716, 17716,
        17716, 17715, 17715, 17714, 17715, 17713, 17713, 17716, 17716,
        17715, 17717, 17708, 17708, 17704, 17717, 17712, 17712, 17712,
        17720, 17720), class = "Date"), datum_start_promo = structure(c(2932896,
        2932896, 17232, 2932896, 2932896, 2932896, 2932896, 17712, 17713,
        17713, 2932896, 17712, 17712, 2932896, 2932896, 17712, 17712,
        17712, 17712, 2932896, 2932896, 17687, 2932896, 2932896, 2932896,
        17712, 17712, 2932896, 2932896, 2932896), class = "Date"), datum_end_promo
        = structure(c(2932896,
        2932896, 17253, 2932896, 2932896, 2932896, 2932896, 17743, 17727,
        17727, 2932896, 17743, 17743, 2932896, 2932896, 17743, 17743,
        17743, 17743, 2932896, 2932896, 17711, 2932896, 2932896, 2932896,
        17743, 17743, 2932896, 2932896, 2932896), class = "Date")), row.names =
        c(NA,
        30L), class = "data.frame")

        df %>%
        mutate(promo_active = if_else((datum_besteld >= datum_start_promo &
        datum_besteld <= datum_end_promo), 1, 0, missing = NULL),
        weekday = weekdays(datum_besteld),
        weekend = if_else(weekday == "Saturday" | weekday == "Sunday", 1, 0, missing = NULL)
        )
        ```


        Important Note: Rmd's are really bad to debug. If you still face problems, just run the code line by line in console.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 21 '18 at 9:36









        ChristophChristoph

        2,85921942




        2,85921942

























            0














            can u try the below code once



            ```{r include = FALSE}
            # create promodata
            df2<-df %>%
            mutate(promo_active = if_else((datum_besteld >= datum_start_promo &
            datum_besteld <= datum_end_promo), 1, 0, missing = NULL),
            weekday = weekdays(datum_besteld),
            weekend = if_else(weekday == "Saturday" | weekday == "Sunday", 1, 0, missing = NULL)
            )

            df2
            ```





            share|improve this answer
























            • hi, thank you for your reply and time. It did not work. The error is the same

              – JL B
              Nov 21 '18 at 8:56













            • is it worked? update if it worked?

              – sai saran
              Nov 21 '18 at 8:56











            • it did not work

              – JL B
              Nov 21 '18 at 9:01
















            0














            can u try the below code once



            ```{r include = FALSE}
            # create promodata
            df2<-df %>%
            mutate(promo_active = if_else((datum_besteld >= datum_start_promo &
            datum_besteld <= datum_end_promo), 1, 0, missing = NULL),
            weekday = weekdays(datum_besteld),
            weekend = if_else(weekday == "Saturday" | weekday == "Sunday", 1, 0, missing = NULL)
            )

            df2
            ```





            share|improve this answer
























            • hi, thank you for your reply and time. It did not work. The error is the same

              – JL B
              Nov 21 '18 at 8:56













            • is it worked? update if it worked?

              – sai saran
              Nov 21 '18 at 8:56











            • it did not work

              – JL B
              Nov 21 '18 at 9:01














            0












            0








            0







            can u try the below code once



            ```{r include = FALSE}
            # create promodata
            df2<-df %>%
            mutate(promo_active = if_else((datum_besteld >= datum_start_promo &
            datum_besteld <= datum_end_promo), 1, 0, missing = NULL),
            weekday = weekdays(datum_besteld),
            weekend = if_else(weekday == "Saturday" | weekday == "Sunday", 1, 0, missing = NULL)
            )

            df2
            ```





            share|improve this answer













            can u try the below code once



            ```{r include = FALSE}
            # create promodata
            df2<-df %>%
            mutate(promo_active = if_else((datum_besteld >= datum_start_promo &
            datum_besteld <= datum_end_promo), 1, 0, missing = NULL),
            weekday = weekdays(datum_besteld),
            weekend = if_else(weekday == "Saturday" | weekday == "Sunday", 1, 0, missing = NULL)
            )

            df2
            ```






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 21 '18 at 8:46









            sai saransai saran

            356224




            356224













            • hi, thank you for your reply and time. It did not work. The error is the same

              – JL B
              Nov 21 '18 at 8:56













            • is it worked? update if it worked?

              – sai saran
              Nov 21 '18 at 8:56











            • it did not work

              – JL B
              Nov 21 '18 at 9:01



















            • hi, thank you for your reply and time. It did not work. The error is the same

              – JL B
              Nov 21 '18 at 8:56













            • is it worked? update if it worked?

              – sai saran
              Nov 21 '18 at 8:56











            • it did not work

              – JL B
              Nov 21 '18 at 9:01

















            hi, thank you for your reply and time. It did not work. The error is the same

            – JL B
            Nov 21 '18 at 8:56







            hi, thank you for your reply and time. It did not work. The error is the same

            – JL B
            Nov 21 '18 at 8:56















            is it worked? update if it worked?

            – sai saran
            Nov 21 '18 at 8:56





            is it worked? update if it worked?

            – sai saran
            Nov 21 '18 at 8:56













            it did not work

            – JL B
            Nov 21 '18 at 9:01





            it did not work

            – JL B
            Nov 21 '18 at 9:01


















            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%2f53407695%2ferror-knitting-flex-dashboard-rmarkdown-dplyr%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

            'app-layout' is not a known element: how to share Component with different Modules

            android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

            WPF add header to Image with URL pettitions [duplicate]