I get the following error message and do not know how to debug it:
> dt_final <- dt_final %>%
+ group_by(ID) %>%
+ mutate(returns = (x1-lag(x1))/lag(x1))
Error in `vec_as_location()`:
! `...` must be empty.
x Problematic argument:
* call = call
In principle the code works without issue. Can you run the following code and does it error ?
library(tidyverse)
(a_ <- tibble(ID=rep(1:2,each=2),
x1 = 1:4))
(b_ <- a_ %>% group_by(ID) %>%
mutate(returns = (x1-lag(x1))/lag(x1)))
If your session got into a bad state, restart it without reloading workspace i.e. start clean, and try your code again, perhaps it will work.
Perhaps if you have some old package version/versions.
Use SessionInfo()
to see a shareable list you can provide here, or you could simply adopt the latest with update.packages()
Yes, even if I run your code I get the same error.
so, likely you would need to update your packages.
nirgrahamuk:
update.packages
I did with update.packages() but error still occur and code use to run 2-3 weeks ago.
can you provide your sessionInfo() ?
nirgrahamuk:
sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19043)
Matrix products: default
locale:
[1] LC_COLLATE=English_Germany.1252 LC_CTYPE=English_Germany.1252 LC_MONETARY=English_Germany.1252
[4] LC_NUMERIC=C LC_TIME=English_Germany.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.0.2 cli_3.2.0 tools_4.0.2
I suggest you load the required libraries and try again, i.e.
library(tidyverse)
sessionInfo()
nirgrahamuk:
sessionInfo()
This did not help. I used library("packagexyz")
idontknow:
This did not help.
Its for information purposes, i.e. when I do it I can see (with other parts omitted)
other attached packages:
[1] magrittr_2.0.3 forcats_0.5.1 stringr_1.4.0 dplyr_1.0.9 purrr_0.3.4 readr_2.1.2
[7] tidyr_1.2.0 tibble_3.1.7 ggplot2_3.3.6 tidyverse_1.3.1
so do you have ggplot2_3.3.6? what do you have ?
below that I could determine I have package version 0.4.1 of 'vctrs', do you have the same ?
For vctrs, I found that i have vctrs_0.3.8.
Is that the issue?
could be, try to install it again.
install.packages("vctrs")
1 Like
system
Closed
August 23, 2022, 2:51pm
13
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed. If you have a query related to it or one of the replies, start a new topic and refer back with a link.