-1

I am running Rstudio on my macbook Pro for a coursera course "learning to program with R"

I cant seem to figure out why the "mutate" function isnt working.

I am using the following code.

{r calc-total-bapt-vars-save}
arbuthnot <- arbuthnot %>%
  mutate(total = boys + girls)

I keep getting an error that "%>% could not be found. Am I missing something?

MrFlick
  • 195,160
  • 17
  • 277
  • 295
Joseph Yeagle
  • 13
  • 1
  • 7

2 Answers2

1

Try:

install.packages("magrittr") 
install.packages("dplyr")

library("dplyr") 
library("magrittr")

mutate belongs to the dplyr library, while %>% (pipe) belongs to magrittr.

P Ackerman
  • 2,266
  • 20
  • 24
0

Try this

install.packages("magrittr")

require(magrittr)

The pipe operator %>% is a magrittr functionality

Gompu
  • 415
  • 1
  • 6
  • 21