Suddenly above error messages come when I type a single character on my R studio script window. What is the reason? And Is there somebody tell me how to fix it?
Usually this problem is associated with using non-English characters in the directory name (for packages, working directories etc.). In your case it is connected to auto-completion basename(.rs.listIndexedPackages()) - hence when you are typing a character an error is thrown. See the similar problem Issue loading data of “file name conversion problem - name too long?”.
Generally it advisable not to use non-English characters for directory name. And if the above mentioned error was thrown, you would either clear the RStudio environment by deleting temporary RStudio files or rename related directories from Korean to English.
Related
I tried to download the latest version (4.2.0) of R on my windows computer and received this error message upon trying to open the program. "Fatal error: 'R_TempDir' contains space". Has anyone ever had this issue or have any ideas on how to resolve it? I have tried reinstalling the program and moving where the program is stored but no luck.
I also experienced this issue with 4.2.0 of R on Windows 10 but not prior versions of R.
In my case, the reason was the default temporary file folder was within my user directory and my user ID has a space in it. Apparently this causes an issue.
I was able to work around it by setting the global environment variable TMPDIR in windows:
Go to the search box next to the start button and type "environment"
Click on the choice which says "Edit the system environment variables"
Click the button that says "Environment Variables" near the bottom of the window
Click "New" and enter TMPDIR for variable name and some suitable directory without spaces under variable value (I chose C:\Temp)
As an aside, I do not believe this is an RStudio specific issue (and 4.2.0 isn't a version for RStudio anyway).
Thank you Venk for your post. It didn't work for me, but it pointed me in the direction of a solution that did.
I changed the values of my TEMP and TMP variables to a folder that had no spaces in it or in any folder name in the path (as you note).
I'm working on a Windows 10 machine.
Rob
P.S. My first solution was to revert to an earlier version of R, which initially worked. Recently though, I got the same error, even using a previous version. I'm no expert, but the whole thing is very weird IMO.
Had the same issue, and the other proposed solutions didn't resolve it for me. (R 4.2.2 and Windows 10.)
Solution found here worked for me:
create a file named renviron.site that contains the following text, and save it to the Desktop, using a text-editing program.
TMP=C:/Temp TEMP=C:/Temp TMPDIR=C:/Temp
if a copy already exists, may need to handle that case-by-case
move the file to C:\Program Files\R\R-4.2.x\etc
I wasn't able to save directly to this folder, despite being in the admin account.
I tried the other solutions and none worked. I came across this post that suggested to not install R in the /Program Files/ folder, to instead modify the installation to the folder C:\R\ which worked.
I didn't go back and undo the work done based on previous suggestions, so I'm not sure if they too are needed.
I'm running into a weird problem when I want to check (Rcmd check) an R package. Every few steps of the checking process, I receive the following error message:
I can close the message and everything works as expected, but it's pretty annoying to close the message since it pops up every few seconds.
The error stems from fact that R also comes with it's own zlib1.dll (C:\Program Files\R\Tcl\bin64\zlib1.dll) but finds the one from IBM Notes.
This seems to be connected with the PATH environment variable. In PATH, C:\Program Files (x86)\IBM\Notes\ZLIB1.dll appears earlier than the R related directories. I can't change that, since I hhave only rights to alter the user-specific environment variables.
Is there a possibility to tell R specifically, where to search for ZLIB1.dll?
EDIT:
If I change the directory from which RStudio is started, the error does not occur any more, but RStudio does not remember the last used project.
I have recently started using R for uni. I want to save my code using either save as or ctrl+s. However, the saved file is empty more often than not. For some reason, the files save normally on a few occasions. However, they also became empty after saving changes to the script.
I couldn't find any solution for the problem, neither here nor anywhere else.
I am using RStudio installed via Anaconda on an Windows 10 x64 Notebook, if that helps.
Thanks a lot for the responses! I'd be glad to provide more details if needed!
This is what the saved files look like from File Explorer:
I just meet the exactly same problem. I solved it by checking and changing RStudio -> File -> "Save as Encoding" from "ISO-8859-1 (System default)" to "UTF-8", then the file was saved. I'm trying to recover my previous 0kb files...
i couldn't reproduce the error but i also don't like to use the anaconda environment.
if the problem is saving the text file than may i suggest to do just that and save the code in a regular .txt file?
if this is not an option you can try to find out what happens if you save the r studio code on a different drive (or usb/flash drive)
###########################################################
EDIT 14.07.2022
Interestingly enough, just today (14.07.2022) I had the same problem. After installing R 4.2.1 everything worked fine until I changed the encoding (from utf-8 to windows 1252), at which point all the files in my project were overwritten and are now empty. Changing back to an older version of R (4.1.3) allowed me to display/save/use all scripts again (from backups).
Using the answer provided by #Shidan it is possible to open the data in R-4.2.1 as well.
This problem does not seem to be connected to Anaconda but an encoding issue between Rstudio and any R distribution above (and including) 4.2.
I have been using read.dbc function from read.dbc package and it is working fine for me.
Unfortunatelly, sometimes the file to be read is corrupted. To handle this, I use the try statement. The problem is that the corrupted file keeps "open" in R until I finish my R session, in a way I can't delete the file until the session is over.
My code is:
ReadFile <- try(read.dbc("C:/LocalPath/A_File.txt"))
Is there a way to "close" the connection prematurely (without the need to end the session)?
Also, I have tried to remove the variable with rm() and then cleaned the memory with gc() but the file keeps open.
More details: RStudio v0.99.484, R v3.3.1 (x64), OS Windows 7 Enterprise SP1
PS.: To reproduce the error simply try to read any file that is not a dbc file, a TXT file for example.
I don't think that this can be done in R as the file is locked from C code. If you look at the function dbc2dbf in this file you can see that it opens the file and tries to decompress it. Error "handling" is just printing the error and returning, but not closing the opened files which is bad practice imo. (Or a bug if you like to call it so.)
If you care you could open an issue on the github site of the project for this, maybe the author fixes the problem.
In case you are in desperate need (:P) of a working version I have compiled a quick fix for you that just calls fclose before it signals the error(s).
You can download it here. Just unpack and copy to your R library. Load with library(custom.read.dbc)
I'm now work on a project which wants to use org.rosuda.REngine.Rserve to use facilities of R by C#. I have a particular problem that when I run the following code in C# client side:
c.eval("pdf(file=\"plots.pdf\", width=11, height=8.5)");
c.eval("plot(1,2)");
An error occour which said
Error in plot.new():cannot open file '', reason No such file or directory
But I checked that the file "plots.pdf" has already been created successfully by "pdf.." function. In R semantics, the successive plot() will output figure to the active device opened by the "pdf(...)" function, i.e. "plots.pdf" this time. But I'm very confused that why the error indicated that the file is ''.
I use R-2.15.0 and Rserve-1.7.0 in linux server side.
I'm eager to see your response.
Thanks a lot.
Try this code :-
c.eval("dev.off()")
A folder named (null).1001.1001
Related answer at
Cannot open file '', reason No such file or directory
suggests using file.path as a alternative to paste for creating filenames with platform-independent path separators.
Comments suggest dev.off(). I had better luck with graphics.off(). The difference is that dev.close() closes the current device, graphics.off() closes all open devices.
But my solution turned out to be
https://askubuntu.com/questions/721485/what-is-folder-null-1001-1001
I found a mysterious folder named (null).1001.1001 (Rserve is running as uid 1001, gid 1001 on Linux). I create this folder at the start of my session and I'm good to go. The presence of this folder seems to help in my case, but I don't know (yet!) what that folder is.