Managing large data in R studio give "Cannot Connect to R" error

Hi everyone,
I'm working with a huge database and since I've started R is having problem computing the operation that I wrote. This error does not always appear but in particular it is encountered when I try to upload a file in .xlsx format that is 41.4 Mb (12000 column and 1000 rows approximately).

The following is the error that I get:
"Cannot Connect to R
RStudio can't establish a connection to R. This usually indicates one of the following:

The R session is taking an unusually long time to start, perhaps because of slow operations in startup scripts or slow network drive access.
RStudio is unable to communicate with R over a local network port, possibly because of firewall restrictions or anti-virus software.
Please try the following:
If you've customized R session creation by creating an R profile (e.g. located at ~/.Rprofile), consider temporarily removing it.
If you are using a firewall or antivirus software which guards access to local network ports, add an exclusion for the RStudio and rsession executables.
Run RGui,, or R in a terminal to ensure that R itself starts up correctly.
Further troubleshooting help can be found on our website:
Troubleshooting RStudio Startup"

I would like to ask the community suggestion about working on such large data.

Just for info, I'm working with Ubuntu 18.4.5

uploading typically refers to transferring a file from a client machine to a host/server machine.
Is there such a dynamic in what you are doing or are you working entirely on your local machine ?

1 Like

I'm working entirely in my machine.

Could be better if I work on that data entirely running R in terminal?

I dont think so.

What process are you following with the xlsx file?
What buttons are you pressing or code are you typing to load it?

1 Like

Start with library


#Import the data
my_tab <- read_excel("my_file.xlsx")

Sometimes the reading of the file is successful while other times the error message appears.

That seems fine.
Its unfortunate that your issue is intermittent, if it was reproducible it might be easier to solve, sorry, I have no ideas for you given the info you provided...

whats your packageVersion("readxl") ? I think 1.3.1 is the latest

At the moment I've removed my r base and R studio version and installed the latest one.
I've saved the data in .csv format and I've tried again to load the files. I've noticed that if I'm working in the R studio console without using R markdown it works better. But I still have the problem of crushing when i try to plot some graphs with ggplot.

That's the situation... sometimes it keeps freezing my computer.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.