"Rstudio has stopped working" when trying to import data

Hi, I am using RStudio 1.2.1335 on Windows 8. Microsoft Ropen 3.5.3.
When I attempt to import a dataset from my laptop, Rstudio just crashes and this is displayed on the screen. "Rstudio has stopped working".

I am new to using R on Windows and relatively new to R as well. It used to function quite well on my mac. please help

Hi,

Do you have the same issue when you load the data by using a read function?

library("xlsx")

myFile = read.xlsx("myExcelFile.xlsx", sheetIndex = 1, header = TRUE)

In the above example, the read.xlsx takes an Excel file, then the sheet in the excel you like to read (usually 1, but could be you have data in other sheet) and a specification whether the first row is the column names (header = TRUE or FALSE).

Let me know if this also generates the error...

PJ

Hi, Thank you for your response.
Yes, this does generate an error. "could not find function "read.xlsx"
Aarya

Hi,

You have to install the package first:

install.packages("xlsx")

You only have to do this once, then you can load the package

library("xlsx")

I believe the rstudio Import GUI uses readxl::read_excel, not the xlsx package.

Hi,

Yea it does, I'm just used to using this one and wanted to see if a different package would result in the same error. But you are correct.

PJ

Hi
Thank you for the response. But could you help me with the exact command for this readxl::read_excel?

Hi,

Try this:

myData = readxl::read_excel("myFile.xlsx", col_names = TRUE)

You can replace the file name with the path of your file, and change col_names to FALSE if there are none.

Let me know if it works
PJ

Hi PJ,

This worked. Thanks a ton.

I appreciate everyone here taking time out to help a beginner like me.
Aarya

1 Like

Hi PJ,

I just found that the same message "Rstudio has stopped working" pops up when I try to save my file.
Is there a solution to the main problem itself? I guess the problem is happening every time 'choose file' or 'save file' shows up.

Aarya

Hi,

I don't know what that could be, but it sounds like something is wrong in R-studio itself. You'll probably have to uninstall and reinstall R-studio (and/or R) if it doesn't go away and see if it fixes it. If not, you might have to open a new issue and have experts on the R-studio installation help you out.

PJ

By any chance are you using a Dell PC? if so take a look to this related thread.

Thank you! this was the problem. I uninstalled the Dell Backup and Recover software and R is working perfectly well. Thanks again!

1 Like

Hi. I found the source of the problem. Thank you for helping out.

1 Like

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