Where am I going wrong here? I am in RStudio and I want to do some processing on some text data in Python and bring it back to R for some final analysis / plots but I get the error:
NameError: name 'df_py' is not defined
Data & Code:
text <- c("Because I could not stop for Death -",
"He kindly stopped for me -",
"The Carriage held but just Ourselves -",
"and Immortality")
ID <- c(1,2,3,4)
df <- data.frame(cbind(ID, text))
library(reticulate)
df_py <- r_to_py(df)
repl_python()
df_py_clean['text'] = df_py['text'].str.replace("[^a-zA-Z]", " ")
df_py_clean['text'] = df_py['text'].str.lower()
exit