What is '.R' folder and where to look for it? - r

I am a beginner in R. I use Rstudio on my MAC OSX.
I have no idea what does this mean 'create a folder ~/.R and put a Makevars in it.'
I went word by word and tried creating '.R' in my home(~) directory. MAC doesnt allow it saying "You can’t use a name that begins with a dot “.”, because these names are reserved for the system. Please choose another name." ( of course!)
Next I tried to look for .R folder, hoping that it might already be there. But couldn't find it anywhere.
Can anyone please explain where is this '.R' folder on our system? Or how is the whole R folder hierarchy is built.
I tried doing this:
path2 = normalizePath("~/.R")
Warning message:
In normalizePath("~/.R") :
path[1]="/Users/as82986/.R": No such file or directory
setwd(path2)
Error in setwd(path2) : cannot change working directory
Problem is I couldn't even find anything on google because looking for '.R' folder threw pretty vague and unrelated results.
Also, would appreciate if I am not directed to any more documentations. Please. And thank you so much for helping me.

You need to use the Terminal.app to open a Unix console and then type:
$ mkdir ~/.R
The dollar sign is there to remind you that this is not the R console which has a ">" prompt. (Do not type the "$".) You are going to need to learn a few more lessons about the Unix commands if you plan to compile packages from source. I generally run my Finder with ShowAllFiles set to Yes. Do a google search if that is not meaningful to you.

Related

Installation packages no longer found after updating my Mac to 12.2.1

I'm using tcsh shell to access installation packages for my research. After a recent update, my login shell is no longer able to find where those installation files are located. I receive a prompt like this:
!! Attention: GEMC installation check /opt/jlab_software/2.5/Darwin_macosx12.2.1-clang13.0.0/gemc/2.9/gemc not found
Where GEMC is one of several installation files.
I see that it is looking in the directory Darwin_macosx12.2.1-clang13.0.0, which is not where the files are located, but rather they are located in Darwin_macosx12.1-clang13.0.0. I tried creating a symbolic link with the following command:
ln -s Darwin_macosx12.2.1-clang13.0.0 Darwin_macosx12.1-clang13.0.0
But I am still receiving the error informing me that the files are not found. I figured that I incorrectly used the symbolic link (and probably still am) so I pasted in the entire paths in the above command, and still no luck.
I am still kind of a newbie when it comes to Unix commands and navigation, so I apologize if I explained this poorly. That being said, I would really appreciate if someone could help me find a solution to this problem. Thank you in advance!

Can I change the location of Homebrew FFTW install? R can't seem to read FFTW3.h file located in Cellar folder

I'm trying to install wholebrain by Daniel Fürth, following the instructions on the macosX install page (available here). I am running MacOS Big Sur 11.5.2, R 4.1.2, and RStudio 2021.09.1.
Unfortunately, the program is not straight-forward to install and requires significant developer tools to work correctly. I'm not a programmer and have almost no experience with coding, so I've been mucking through the instructions for two days now trying to get the install to work correctly and I'm firmly stuck on the final step.
In RS, when I run, devtools::install_github("tractatus/wholebrain", INSTALL_opts=c("--no-multiarch")) I get the following error message:
/bin/sh: pkg-config: command not found filter.cpp:9:10: fatal error: 'fftw3.h' file not found #include "fftw3.h" ^~~~~~~~~ 1 error generated. make: *** [filter.o] Error 1 ERROR: compilation failed for package ‘wholebrain’
I have been trying to figure out what this means for quite awhile now and I think I've narrowed it down to R is not reading the location of the fftw header file from where it was installed by Homebrew. (I could be totally wrong, again- not a programmer)
From what I understand, Homebrew always installs under opt/homebrew/cellar. And, in fact, in there is the compiled fftw program with the needed "fftw3.h" file. But for some reason, RStudio is not able to find and read the file in that location.
From random googling and reading of other posted issues, I think that RStudio may expect the file to be under usr/local/include. Can I just copy and paste the header file into that folder? Or will I be screwing something up if I do that? I am totally intimidated by fftw's description of manual compilation so I don't really want to attempt that. Is there a way to change where R is looking for that header file? I already set my wd to "/" so shouldn't R be able to access any folder on my computer?
I want to post an answer here for anyone who comes after me with the same issue. It came down to RStudio not recognizing the programs Homebrew had installed because it wasn't reading the file location where Homebrew saves them. Homebrew always installs programs in /opt/homebrew/... Here is what I had to do:
In RStudio, open your Renviron file using this command: usethis::edit_r_environ()
In the file that opens (which for me was totally blank), type: PATH=/opt/homebrew/bin:${PATH}, or whatever your particular path you want prepended to the Renviron path is.
Quit RStudio and, when prompted, save. Re-open RStudio and run Sys.getenv("PATH") to check. Your new path (in the example above, '/opt/homebrew/bin') should now be prepended to the list of paths that RStudio will use when looking for programs/files. For me this now looks like /opt/homebrew/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/Library/Apple/usr/bin:/Applications/RStudio.app/Contents/MacOS/postback
Finally, I want to say thank you very much to Mark Setchell who really helped point me in the correct direction!

The help systems return "help provider not available"

I'm using visual studio code to program in R and I have recently had trouble using the ?func and ??func command.
When typing something like ?rnorm, the message Couldn't show help for path: /library/stats/html/Normal.html shows up. The path is there and I'm sure R is in the path environment. This is really boggling me.
When I first installed R it was working absolutely fine in VSC but now it does not work. However the function works in the R shell. When I try to navigate to the R extension and click on "Help Topics by Package" it says help provider not available.
The packages/html files are there, but VSC doesn't want to access them.
Please advise what I can do to solve this.
I solved the same issue by checking my environmental variables. The steps I followed:
I added the bin installation file (C:\R\R-4.1.3\bin in my case, or C:\Program Files\R\R-4.1.3\bin) to the path in my user environmental variables. If you have an admin account, then you have to add the bin folder to the system environmental variables.
Check if you can start a R console from any terminal.
If that is positive, then in the Rpath settings for the R extension in vscode write r, or in the settings.json: "r.rpath.windows":"r"
Restart vscode. Check if the help pages are working.
Hope this helps ! Cheers.
This happened to me as well. I googled and tried different things and this works for me:
You need to provide the Rpath for the system you are using in the settings for the vscode R package. For example, for a windows machine, you need C:\Program Files\R\R-4.1.3\bin\x64\R.exe there if you installed the latest R using the default settings, and similarly for other systems.
Hope it helps!

Changing the temporary directory in R

First of all, I am aware of the following discussion covering the same topic. However, following the instructions, I can still somehow not change the temporary directory.
I installed Anaconda for my local user and then installed R. When I try to start R, I get the following error
Fatal error: cannot create 'R_TempDir
The problem seems to be that there is no available space left in /tmp. Unfortunately, I need administration rights to either allocate more space or to remove Rtmp-files.
I followed some answers of the other discussion and changed the TMPDIR path in my Renviron file to a local folder. However, this seems to be ignored since I get the exact same error. My Renviron file look as follows:
TMPDIR="${HOME}/user_name/tmp"
TMP="${HOME}/user_name/tmp"
TEMP="${HOME}/user_name/tmp"
, where I replace my actual user name with "user_name". I was actually suprised that my temporary directory is a root directory and not under my user.
If someone has any idea what's wrong with my approach, I would very much appreciate some help.

Error occurs on using the bin/hubot command

I am working with Hubot.I have made a myhubot directory in the C drive.Now when I am in the myhubot folder ,and I am using the command bin/hubot (as given in https://hubot.github.com/docs) I am getting the error ==>'bin' is not recognized as an internal or external command,operable program or batch file.When I am changing the directory to bin (that is, now I am in C:\myhubot\bin) and then using hubot command,the error given is ==>the system cannot find the path specified.I have checked my bin folder and it has two files(hubot and hubot.cmd).Please help in sorting out the problem.Thanks in Advance.
The "/docs" link you posted shows instructions for Unix/Linux.
And since you mentioned "C drive" I think you're trying to install Hubot on Windows. I think you're going to have a lot of problems trying to adapt those to Windows, so I recommend you use the Windows-specific deployment docs instead:
https://hubot.github.com/docs/deploying/windows/

Resources