Memory error when kniting in R - r

I try to knit an Rdata file in R studio and get an error that cannot allocate vector 1,8mb.
I understand that I have memory issue so I tried to use memory.limit() as suggested on another post but I got an error
memory.size() is Windows-specific.
I also made extra RAM using a usb and changing swappiness but nothing happened. I'm using Ubuntu 14.04 32bit, R Version 3.3.0 32bit and also I have Windows O/S installed.

The problem is that you're on a 32-bit installation of R and you've used up the (very small) amount of memory it can handle. If you just switch to 64-bit you won't get this error.
The error message is because you invoked a Windows-specific command on Ubuntu, but that's really not relevant because with 32-bit R there's a hard limit on memory which you've already hit.
I know this is confusing because it's complaining about a very small size vector (1.8 MB) but that just means that the remaining amount of memory 32-bit R can handle is less than that.
If you were on Windows you might need to set the memory limit in addition to using 64-bit R, but if you're using Ubuntu then just using 64-bit R should solve the problem.
RStudio Instructions
I'm basing this on my version of RStudio, yours might be slightly different but it should be very close.
Click Tools
Click Global Options...
With the "General" (default) screen selected click Change where it says "R version:"
Select Use your machine's default version of R64 (64-bit)
Click OK
Allow RStudio to restart

Related

R package: Error appears not in Windows but in Linux

guys.
I am currently trying to build an R package (using rcpp). By this suggestion, I encountered an error, which was fixed by putting the following line in src/Makevar and/or src/Makevar.win.
PKG_CXXFLAGS = -DRCPP_ARMADILLO_FIX_Field
However, this error disappeared when I run my function in Windows on my laptop, but it again appeared in Linux. (I usually wirte the code in Windows on my laptop and run the code by using Linux for parallel computing provided by my university) It seems that that line can remove the flag in Windows but cannot remove it in Linux.
How can this happen, and how can I fix this?

R plot doesn't work on my Windows, but plot.default does

I'm taking a course in R and I've hit a road block on day one.
Typing:
demo(graphics)
...should start a series of graphs being displayed on screen. On my Windows 10 (64 bit) new Dell laptop, I get a persistent error:
The execution is stopped after the red lines, seemingly because the demo(graphics) call is being made with incompatible parameters. In blue I make the same call but use the default function and an empty plot is displayed.
I have tried uninstalling and reinstalling everything, installing through Anaconda and from the CRAN website. The same error persists. I've even tried with mro instead of basic R.
I don't see any similar error messages in my class or on Google. My guess is that I need to install a particular version of R and RStudio make it work but I'm guessing.
Can anybody offer some expertise?
I'm running R version 3.6.1 (2019-07-05) (which is executing code correct, just not the demo call) and RStudio Version
Running the basic Rgui software from the command line with the --vanilla parameter like so:
Rgui --vanilla
Opened Rgui and the
demo(graphics)
...call worked.
This meant that the issue was in the .Rprofile file. This is found in the etc folder of the basic R installation and when I checked, it looked absolutely fine (entirely commented out actually).
I wanted to use RStudio though, so I investigated the RStudio docs and saw that each project is given its own .Rprofile style initialization file when a new project is created.
So I created a new project with RStudio and by creating a new project whatever configuration issue was causing the error was completely fixed.
Credits to G. Grothendieck for the answer in the comments.

R platform failed to start in Windows 10 when inside directory containing white spaces

I'm working with a software project that requires the portable version of R platform. My intention is to use R in any version of Windows and in any compatible computer.
Problem: In Windows 7, R works fine without any worries, even in portable version. However, in Windows 10 (and probably also in Windows 8), R does not start when put the entire folder inside a directory containing whitespaces (ex.: "C:/Users/Main/Documents/My Folder/RVersion").
In Windows 10, with the absence of spaces, R runs fine. In the presence of spaces, all executable (Rscript.exe, R.exe, etc) except Rgui.exe just open a console and closes instantly. The problem is: I really need that R works in any folder (this is a important part of the project).
Additional information:
I found that R does not work well in directories without the 8dot3 format - and it think that Windows 10 lost this property, which was present in Windows 7. Also, the problem is clear when I run Rgui.exe in a whitespace-containing directory and try to run system("R.exe", intern=TRUE) function: It throws an error indicating that only the part before the first space in directory name was taken into account. Here is the message:
> system("R.exe", intern=TRUE)
[1] "'C:\\Users\\Main\\DOCUME~1\\My' nÆo ‚ reconhecido como um comando interno"
[2] "ou externo, um programa oper vel ou um arquivo em lotes." attr(,"status")
[1] 1
Warning message:
running command 'R.exe' had status 1
Translation of messages [1] and [2]: "'C:\...\My'" not recognized as a internal or external command, nor a program operation or dataset
The same occurs with non-portable version of R, as I already tested.
When I run with a .bat file with the corrected (quoted) directory as input, R.exe runs, but in a disfunctional form and looking like cmd.exe (no R command worked).
I have no ideia how to change variables such as R_HOME to a readable version before R prompt starts.
System/Resources:
Windows 10 Home 64-bit with the last update.
Dell Notebook with Intel i7-5500U 2.40 GHz (not so relevant, I think)
R and R portable 3.3 (last version until this post), downloaded here:
[https://sourceforge.net/projects/rportable/]
I believe that, with the popularity of Windows 10, many other users could face this problem (specially those who depend of R portability).
Thanks in advance!
In the end, I found a plausible solution by myself.
I realized that every time the R.exe is executed in a directory without spaces, the execution is automatically redirected to Rterm.exe. I don't know if they fixed the bug specifically to Rterm.exe in the last version, but this suggests that the Rterm executable is the responsible for opening the R console, and when I tried to execute it directly through a spaces-containing directory, it worked fine (at least in the last R version).
So, in summary, if someone else had this problem, just run Rterm.exe directly.
This resolution is useful enough for those who just depend on R portability, although the Rscript.exe and R.exe still are not working in these conditions. Rscript.exe is useful to execute scripts directly without the need to manually start a new session in a new window, and R.exe redirects to Rterm.exe based on your system, if it is 32-bit or 64-bit (at least as I observed).
Anyway, I already informed CRAN project about this bug, and I hope they check it and fix the issue in the next version. If someone else found an alternative solution, feel free to comment.

R 3.0.0 crashes on startup

I just updated R from version 2.15.1 to version 3.0.0 on my MAC running 10.6.8 and now R crashes on startup.
I get the error:
Error in getLoadedDLLs() : there is no .Internal function 'getLoadedDLLs'
Error in checkConflicts(value) :
".isMethodsDispatchOn" is not a BUILTIN function
Any ideas on how to go about?
The most common cause of this is having a corrupted ".Rdata" file in your working directory. Using the Mac Finder.app you will not by default be able to see files that begin with a ".", so-called dotfiles. Those files can be "seen" if you execute a change to the plist controlling the behavior of Finder.app. Open a Terminal.app window and run this bit of code:
defaults write com.apple.Finder AppleShowAllFiles YES
Then /point/-/click/-/hold/ on Dock-Finder-icon, and choose "Relaunch"
If you to do so, you can then change it back with the obvious modfication to that procedure. I happen to like seeing the hidden files so that's the way I run my Mac all the time, but some people may feel it is too dangerous to expose the "hidden secrets" to their own bumbling.
Paul raises a good point: I run the following R function in the R console after updating:
update.packages(checkBuilt=TRUE, ask=FALSE)
I have a lot of installed packages and paging through the entire list has gotten too tiresome so I bypass the ask-messages. Sometimes you will get errors because there may be dependencies on r-forge or Omegahat packages or on packages that need to be compiled from source. These may need to be updated "by hand". And you may need more than one pass through such an effort. Take notes of which packages are missing and fill them in.
I had the same problem running RKWard on ubuntu 12.04.
Check your r-base-core, like Paul suggested, to make sure the version is also at the latest version. Mine didn't update automatically. I had a platform dependent version, but RKWard was calling the new version. To solve this problem, I simply marked r-base-core for removal and reinstalled the latest version or r-base-core. poof problem fixed, bippity boppity boo!
I suspect that your error is similar to mine because I had also JUST updated RKWard. Start at updating r-base-core or try to get all of the dependencies to match up the versions.
I hope that you can translate this into what to do on a MAC,
SU

Using StatET with Eclipse in Win64: "no session of R is active in the current workbench window"

What do I do when I get the following error message in Eclipse when trying to launch R?
"no session of R is active in the current workbench window"
I've made a tutorial for installing StatET on my Win64 system, you can find it here (mirror). Although it's no rocket science it's easy to get into issues along the way.
You need to first configure R for your system and then you also need to go into Run > Run Configurations... and add a R Console before you can run it.
You also need to be careful about the Java version that you use. I had to uninstall all my Java, then reinstall the 64-bit before it worked. I guess I could've used the 32-bit, but since I use 64-bit R I thought that it might be a better option (although I think the Eclipse environment and R don't really care about sharing bits)
for me had to select rterm, that displayed the r console/terminal. Then do run , run as -> run in R as script via source
I had the sampe problem.
go to Run > Run Configurations > RStudio
and klick on "Run"

Resources