-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
  • 178,638
  • 15
  • 253
  • 268
Joseph Yeagle
  • 13
  • 1
  • 6

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,088
  • 18
  • 24
0

Try this

install.packages("magrittr")

require(magrittr)

The pipe operator %>% is a magrittr functionality

Gompu
  • 375
  • 5
  • 19