Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

tidyverse problems when loading tidyverse in .Rprofile

Tags:

r

tidyverse

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.

like image 727
Cettt Avatar asked Oct 22 '25 05:10

Cettt


1 Answers

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)

like image 61
Diego Rojas Avatar answered Oct 23 '25 19:10

Diego Rojas



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!