How to give admininstrative rights while running R script from terminal in Linux?

I have script stored in file name A.r
I am trying to run this file by giving administrative rights, for eg:
Rscript A.r
What additional parameters should i write in my Rscript command to give administrative rights?

Usually anything to do with administrative rights in Linux is done with sudo. Make sure you understand what it does since it might be quite devastating if anything goes wrong.

In windows when we right click and select Run R with admininstrative rights , is this equivalent to sudo in Linux? Because last i checked it was not giving same results.

Can you clarify what you mean by this part? Are you saying that you ran this script "as Administrator" in Windows and also using sudo Rscript A.r in your Linux terminal and the script did not output the same result? Or it failed to run in one situation and worked in the other? Or something else?

I was trying to connect vertica from R in Ubuntu environment.Whenever i gave administrative rights to Rstudio and then using JDBC it was getting connected.Also when i try running from terminal by giving sudo A.r (the same code snippet), it was throwing error.

I think it's going to be hard for anybody to help further without some more information:

  • Can you post the text of the error message you got when you tried to run your script?
  • And, if possible, the contents of the script that you are trying to run (formatted as code, please :grin:)?
java.sql.SQLNonTransientConnectionException: [Vertica][VJDBC](5273) FATAL:
Unsupported frontend protocol 3.8: server supports 3.0 to 3.6.

This is the error i am getting and the code for this script is :

drv <- JDBC(driverClass="com.vertica.jdbc.Driver",
            classPath="C:/Users/sbiswas/Downloads/vertica-jdbc-9.1.0-0.jar")

conn <- dbConnect(drv, paste0("jdbc:vertica://",client.hostname,":5433/",client.dbname)
                  ,user=client.username , password=client.password)
result <- paste0("SELECT * FROM ",paste0(client.table_name),sep="")
temp <- dbGetQuery(conn,result)