I tried following a previous thread, Knitr: could not find function %>% error, but couldn't seem to resolve my issue. The code runs correctly in the console, but when I go to knit I keep getting
could not find function "%>%" error.
I'm concerned I could have too many packages loaded. Below is my best attempt at a reprex. I apologize... I was unsure how to create a data frame out of a datetime object.
library(tidyverse) library(dplyr) library(lubridate) library(readr) library(ggplot2) library(DataExplorer) library(purrr) library(funModeling) library(data.table) library(readxl) library(readr) library(arules) library(arulesViz) library(magrittr) library(forcats) library(agricolae) library(knitr) # Sample data frame dta_samp<-data.frame( InvoiceNo = c( 536366, 2010-12-01 08:28:00), InvoiceDate = c(536367, 2010-12-01 08:34:00) dta_samp_fix <- dta_samp %>% mutate(day = parse_date(format(InvoiceDate, "%Y-%m-%d")), day_of_week = lubridate::wday(day, label = FALSE), time = parse_time(format(InvoiceDate, "%H:%M")), month = format(InvoiceDate, "%m")) # Below is the error I get from R Markdown #Quitting from lines 157-175 (Affinity_Analysis_UK_eCommerce.Rmd) #Error in retail %>% mutate(day = parse_date(format(InvoiceDate, "%Y-%m-%d")), : # could not find function "%>%" # Calls: <Anonymous> ... handle -> withCallingHandlers -> withVisible -> eval -> eval # Execution halted