Cettt
Cettt

Reputation: 11981

tidyverse problems when loading tidyverse in .Rprofile

I recently tried experimenting with .Rprofile files. In my project I am always working with the tidyverse package so I thought I would create an .Rprofile file in the project's main directory which loads the library:

library(tidyverse)

The library is indeed loaded when I open the project but I it is not runnig as usual.

This code gives an error:

tibble(a = 1:5) %>% filter(a > 4)

Error in filter(., a > 4) : object 'a' not found

I assume that I have to include something in .Rprofile but I couldn't find out what it was.

Upvotes: 4

Views: 435

Answers (1)

Diego Rojas
Diego Rojas

Reputation: 199

Did you try using dplyr::filter? There is a filter function by default in R, so you need to specify that is the dplyr's filter. Try with tibble(a = 1:5) %>% dplyr::filter(a > 4)

Upvotes: 2

Related Questions