Hi,
I have a "simple" R script that I need to import into Databricks and am running into errors.
For example:
TipoB <- Techtb %>% dplyr::filter(grepl('being evaluated', Comentarios))
#TipoB$yearsSpec <- NA
TipoB$yearsSpec <- str_replace(TipoB$Comentarios,'[^♂]*being evaluated[^0-9]*',"")
TipoB$yearsSpec <- str_replace(TipoB$yearsSpec,'[ | \\n| \\t][^♂]*',"")
TipoB$yearsSpec <- str_replace(TipoB$yearsSpec,",",".")
TipoB$yearsSpec <- str_replace(TipoB$yearsSpec,"\\+","")
TipoB$yearsSpec <- str_replace(TipoB$yearsSpec,"YRS","")
TipoB$yearsSpec <- str_replace(TipoB$yearsSpec,"~","")
TipoB$yearsSpec <- as.numeric(TipoB$yearsSpec)
I manage to create the TipoB table normally. But then I can't create new columns as I do on Rstudio. I even tried to create an empty column before inserting the data but it did not work. I get this error:
SyntaxError: invalid syntax
File "<command-2335304911107903>", line 1
TipoB$yearsSpec <- NA
^
SyntaxError: invalid syntax
I can read the TipoB table so I know it is there. But why would I not be able to use the "$" symbol? Can anyone help and show me where I'm messing up?
Thanks a lot!