cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

R code that works perfectly on Rstudio does not run here

771407
New Contributor II

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!

1 ACCEPTED SOLUTION

Accepted Solutions

jose_gonzalez
Databricks Employee
Databricks Employee

when you create a cluster, you will need to select aa DBR version. look for "Databricks Runtime version"

View solution in original post

3 REPLIES 3

Debayan
Databricks Employee
Databricks Employee

Hi, Could you please provide some more details on the configuration of the DBR version? R studio version? etc.

771407
New Contributor II

R studio version 2022.12.0.

R latest version available on 08/FEB/2023.

I don't know where to find the DBR version and configuration. Can you direct me?

jose_gonzalez
Databricks Employee
Databricks Employee

when you create a cluster, you will need to select aa DBR version. look for "Databricks Runtime version"

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group