Functions in dplyr generate errors such as Error in mutate_impl(.data, dots, caller_env()) : SET_VECTOR_ELT() can only be applied to a 'list', not a 'symbol'

Hello Everyone,

I have run into a curious problem. I have been using a scrip since some days and it was working fine. Today, function in the {dplyr} are generating error such as :

Error in mutate_impl(.data, dots, caller_env()) : SET_VECTOR_ELT() can only be applied to a 'list', not a 'symbol'

using the distinct function also generates this error. I tried to make a reprex but in that it show that pipe operator is an unrecognoised function. The screen captures and the code and reprex are given below. Please help out.

output from the console:

Sys.info()
sysname release version nodename machine login
"Windows" "10 x64" "build 18362" "DESKTOP-VTDFS5T" "x86-64" "ayush"
user effective_user
"ayush" "ayush"
(.packages())
[1] "reprex" "googledrive" "forcats" "stringr" "dplyr" "purrr" "readr" "tidyr"
[9] "tibble" "ggplot2" "tidyverse" "here" "RSelenium" "lubridate" "stats" "graphics"
[17] "grDevices" "utils" "datasets" "methods" "base"
TrackList %>% mutate(link = str_c("g", str_remove(PetitionID, ",")))
Error in mutate_impl(.data, dots, caller_env()) :
SET_VECTOR_ELT() can only be applied to a 'list', not a 'symbol'

output of the reprex

I am unable to understand what is happening.

following is the code

library(reprex)
library(tidyverse)
Sys.info()
(.packages())
reprex(
TrackList %>% mutate(
  link = str_c("g", 
               str_remove(PetitionID, ","))
)
)

The Object TrackList is part of my environment and the script that I have been using.

Thanking you,
Ayuhs

The reprex() function runs the code you pass inside the function on a clean R session with an empty environment, nothing exists there, so you have to include library calls and definition of the sample data inside the code you pass to the function. To learn how to make a proper reprex, please take a look at this guide.

@andresrcs Thank you so much. That makes sense. Silly of me to not include the library calls inside the reprex function. Will read the guide as well. Sorry for the trouble.

Also the error that was being generated with dplyr functions ([quote="AyushBipinPatel, post:1, topic:50428"]
Error in mutate_impl(.data, dots, caller_env()) : SET_VECTOR_ELT() can only be applied to a 'list', not a 'symbol'
[/quote]) got solved. I removed all the packages that were loaded and loaded the required packages again. I dont know how it happened.

Thanks,
Ayush

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.