gsub-Error if I try to load a (any) workspace

Hello guys,

when i try to load a workspace/environment i get the following error message.

Error in gsub("[\n\r]", "", magic) : input string 1 is invalid
In addition: Warning messages:
1: In grepl("RD[ABX][2-9]\n", magic) :
unable to translate '' to a wide string
2: In grepl("RD[ABX][2-9]\n", magic) : input string 1 is invalid
3: In grepl("RD[ABX][2-9]\r", magic) :
unable to translate '' to a wide string
4: In grepl("RD[ABX][2-9]\r", magic) : input string 1 is invalid
5: In gsub("[\n\r]
", "", magic) :
unable to translate '' to a wide string

I´m not realy into programing and need R only for some simple cluster analytics, boxplots and so on. Until today everything worked fine since may. So .... i don´t realy get what this error wants to tell me :sweat_smile:
I work with simple .xls-files, 2 to 4 columns and like 100 rows, just numbers and the titles in the first line. I have the 4.3.1 version of R.

When i start RStudio i first load readxl and ggplot2 with the library command and the next thing I do is open the workspace. Normaly that just works fine, but as i started RStudio today, I got this error. It doesn´t matter which file I load, I tried files that I already used successfully and completly new ones. Yesterday it just worked smoothly.

It would be nice if someone could explain to me, what this error means and if someone has a solution I would be very grateful.


Does this mean you are unable to load the workspaces ? or the workspaces do load but you get this error message in addition to your data ?

Im unable to load a workspace. I just get the error message.

if you start R clean; restart without auto loading workspaces. so you have an empty environment.
load a simple dataset into the environment; save the workspace. quit out, and load it .
What happens ?

by 'load a simple dataset into the environment; '
I mean something trivial like
myiris <- head(iris)

The iris dataset works fine.

To save and load that workspace ?
I think thats evidence that the workspace save / load mechanism is in general fine.
This implies that the particular workspaces you have this issue with have been spoiled / corrupted in some way particular to them. I'm pessimistic about the likelihood of being able to recover them given you say the workspace doesnt restore your objects.

Looks like youre right. Tried to open the files on another PC with the same error.
Thats sad, but thanks for your help.

This topic was automatically closed 42 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.