dplyr::mutate says the unknown column when running R on Ubuntu (WSL2)

I run the following code on Ubuntu (WSL2) by using Rscript. The error states p_description is a unknown column. But it is clearly a correct column. Please help. Thank you.

df_prod <- readr::read_csv(file_prodef) %>%
  dplyr::rename_with(~paste0("p_", .x)) %>%
  dplyr::mutate(a = substring(p_description, 1, 1))

The outcome on Rstudio IDE [Ctrl + Enter] - pic_1.
The outcome on Ubuntu [Rscript transform.R] - pic_2.

pic_1

Solved. Thank you very much.

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.