object 'merge_data' not found

hi
I have a code that read many csv file's and when run it and call my variable get this error object 'merge_data' not found.
Rstudio version is : 1.4

merge_data <- list.files(path = path,
                          pattern = "\\.csv$",
                          full.names = TRUE) %>% 
    set_names() %>%  
    map_dfr(read_csv, .id = "file_name") %>% 
    mutate(file_name = basename(file_name),
           symbol = str_remove(file_name, ".csv")) %>% 
    type_convert() %>% 
    select(-1) %>% 
    relocate(symbol, jdate) %>% 
    distinct() 

Tested for me and provided I allocate path <- "~" and delete relocate(symbol line - I assume jdate is a field in your CSV which I dont have.) this works for me.

The only way I know to debug this is to go line by line and see what it creates along the way...?

But which line doesn't produce what you expect?

when add this line map_dfr(read_csv, .id = "file_name") to code and run , my variable not found !!

So can you Post the output of:

list.files(path = path,
                          pattern = "\\.csv$",
                          full.names = TRUE) %>% 
    set_names()

yes, my output is similar to a list of path datasets.
[1000] "/media/mg/DACE5304CE52D879/Code/R/bourse/data/tickers_data//vaaf.csv"

I sincerely doubt that the error you shared arrives on the console when you run only the code that you shared.
I would guess that you get an error (which you have not shared) after running the code, and then when you run yet other code (not shared) that relies on merge_data, that would deliver the error message you quoted.

Am I wrong ?

thanks @nirgrahamuk
I solved it by download CSV files again and run the code and don't get any errors!!

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.