Error message "could not find %>%" even though magrittr package is installed

Hi,

I am a beginner in R and while trying to work the codes, have run into several problems. Hope to have someone to help me out.

I have installed the magrittr package in my R session and tried using the piping function. Below is the reprex, showing the code I used and the error message returned.

read.csv('./GreenHorizons/HRIS-January01-snapshot.csv')%>%
left_join(y = read.csv('./GreenHorizons/0101-Payroll-extract.csv'), by = 'emp_id')

#> Error in read.csv("./GreenHorizons/HRIS-January01-snapshot.csv") %>% left_join(y = read.csv("./GreenHorizons/0101-Payroll-extract.csv"), : could not find function "%>%"

Hello, you have to load first the packages that you will use with the library function, so in this case you need to add library(magrittr) at the start of your script

Hope that helps :smiley:

Hi, I have done that. But it still doesn't work.

The strange thing is that the code works at first. When I close and reopen the file a day later, the same code no longer works. I have no idea why this happens.

You have to install the package once but you need to load the library on each new R session you want to use it with.

If you need more specific help, please provide a proper REPRoducible EXample (reprex) illustrating your issue.

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.