Suggestions on connecting local Rstudio to a lab server

Dear experts,

I am learning sparklyr and would like to use it for analyzing a big dataset. I'd like to use a private lab server as my cluster for storing and analyzing the data. The data is now already stored in the server, which I usually access through a remote desktop (x2go). Now I'm wondering if I could connect my local Rstudio directly to the lab server for data analyses?

I read relevant chapters in the book "mastering spark with R" where it lists demo code to connect to many different types of clusters, but it did not mention how to connect to a private lab server. I also could not find any other relevant reference online as to how to connect it. If anyone has experience with it and wouldn't mind sharing the demo code, I would really appreciate it!

Thanks,
Lily