Faced similar issue while executing code as per mentioned blog and then run solution in detach("package:plyr", unload=TRUE)
Blog : https://www.analyticsvidhya.com/blog/2017/09/comparative-stock-analysis/
Master_Data_AutoCorrelations<-Master_Data_lags %>%
gather(key = "lag", value = "lag_value", -c(Stock,Date, Close)) %>%
mutate(lag = str_sub(lag, start = 5) %>% as.numeric) %>%
group_by(Stock, lag) %>%
summarize(
cor = cor(x = Close, y = lag_value, use = "pairwise.complete.obs"),
cutoff_upper = 2/(n())^0.5,
cutoff_lower = -2/(n())^0.5
)
Post running detach,when above code was rerun it worked fine though received warning message as per below ,not sure whether plyr got unloaded or not.And how is the code executed properly ?
Warning message:
‘plyr’ namespace cannot be unloaded:
namespace ‘plyr’ is imported by ‘reshape2’, ‘scales’, ‘broom’, ‘ggplot2’ so cannot be unloaded