Strange invisible "dot" error in Rstudio

Hello everybody, :^)

I'd like to come back to you because it's not the first time this error has happened to me and it really hurts.

I specify that the code works, simply when I come back on the session to try to make it work again it does not work with this error located on an invisible ".

It's really frustrating and I don't understand why.
This is not the first time either.

Data_Extraction<-read.csv("C:XXXX/Documents/Data extraction.csv")


# Package 

library(esquisse)
library(ggrepel)
library(ggplot2)
library(ggpubr)

# - - - - - - - - - - - - - - - - - - 

# Visualisation données de 1830 à 1900

Vue1<-Data_Extraction %>%  filter(date_collected >= 1830L & date_collected <= 1900L) %>%
  ggplot() +
  aes(
    x = date_collected,
    y = Concentration.ADN,
    fill = preservation_method,
    colour = preservation_method,
    label= complete_name ) +
  labs(x = "Date of sample",
       y = "DNA Concentration (uL / ng) ",
       title = "DNA quantification plot",
       subtitle = "Colored by type of preservation")+
  geom_point(shape = "circle", size = 2.5) +
  scale_fill_hue(direction = 1) +
  scale_color_hue(direction = 1) +
  theme(axis.line = element_line(colour = "darkblue", size = 1, linetype = "solid"),
        legend.position = "none",
        legend.background = element_rect(fill="lightblue",size=0.5, linetype="solid", colour ="darkblue"),
        axis.text.x = element_text(face="bold",size=14, angle=45),
        plot.title = element_text(hjust = 0.5),
        plot.subtitle = element_text(hjust = 0.5))

Vue1

The strange error message :

Error in filter(., date_collected >= 1830L & date_collected <= 1900L) : 
  object 'date_collected' not found

While it's well written : " Data_Extraction %>% filter(date_collected >= 1830L & date_collected <= 1900L) " without any dot thing ...

Please help me :anger: :face_holding_back_tears:

you have not loaded library(dplyr) or library(tidyverse) which contains dplyr, therefore
rather than having access to dplyr::filter()your code is attempting to access stats::filter which comes automatically in the R language out of the box.

you can use

getanywhere(filter)

at any time, to see what functions called filter might be available from different sources in your current environment.

1 Like

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.