How to install ESS on Mac OS X - r

I am trying to use Emacs instead of R on my Mac machine. I've been looking online how to install ESS so that I can use R in Emacs. But I am really confused by the installation manual which says,
Extract all the files from ess-VERSION.tgz into the directory PREFIX/site-lisp where
PREFIX is appropriate for GNU Emacs on your system; PREFIX will most likely be
either /usr/share/emacs or /usr/local/share/emacs (on Mac OS X, PREFIX will
most likely be something like /Applications/Emacs.app/Contents/Resources):
Where do I find this: /Applications/Emacs.app/Contents/Resources. I looked at Applications folder and it only contains the application file emacs.

Mac applications are bundled in folders with the .app extension. These folders are handled in a special manner by the finder which hides their contents. (See https://superuser.com/questions/78176/how-do-mac-app-execution-files-work for info). Specifically in you case /Applications/Emacs.app is really a folder. To get to its contents right click on it and choose "Show package contents". You will be able to get to /Applications/Emacs.app/Contents/Resources from there.

The ESS documentation recommends using a modified version of Emacs, which includes ESS and a few other packages. It is available for Windows and Mac.

Related

How to completely remove Xserver from OpenBSD?

I just installed OpenBSD 6.9 to study how it works.
I wanted to get the most minimal config possible, because I want to use it as a server.
During instalation I chose the option to not install Xserver, but I still have the /usr/X11R6 and /etc/X11 directories with X config and commands like startx. The only difference is that now, startx doesn't work. I tried installing on VirtualBox and on bare metal and both were the same.
What do I have to do in order to completely remove X from OpenBSD? And why is it still being installed in my machine even if I explicitly write "no" when prompted during installation?
My system:
OpenBSD 6.9
Intel Pentium G5400
Nvidia 1050 ti.
OpenBSD installation uses different file sets => see OpenBSD FAQ / File Sets
X11 installation is split into 4 file sets :
xbase71.tgz : Base libraries and utilities for X11 (requires xshare71.tgz)
xfont71.tgz : Fonts used by X11
xserv71.tgz : X11's X servers
xshare71.tgz : X11's man pages, locale settings and includes
During installation, you chose not to install xserv71.tgz (X servers) but you still have installed xbase71.tgz (startx command and others directories).
If you want to completely remove X from OpenBSD, during installation, remove every file set for X. But you should keep xbase71.tgz because some programs needs it to run correctly even if it's a non-X program.
I'm not a OpenBSD developer, so I cannot give a clear answer. But some specific packages which you can add with the package command from OpenBSD (pkg_add), needs some X libraries or binaries.
As example when you want to add vim for the first time, then you have eight flavors:
$ pkg_info -d vim-8.2.3456-no_x11
Information for inst:vim-8.2.3456-no_x11
[REMOVED]
Flavors:
gtk2 - build using the Gtk+2 toolkit
gtk3 - build using the Gtk+3 toolkit (default)
no_x11 - build without X11 support
lua - build with Lua support
perl - build with Perl support
python - build with Python support
python3 - build with Python3 support
ruby - build with Ruby support
It's depends on the packages what you need. Also when you want install something from the port collections.
You can try the quick and dirty way and simple remove your mentioned directories. But I could be possible that some programs from the base system no longer works, because of missing dependencies.

How do you make RStudio remember R installations it used in the past?

I use a separate installation of R for each project.
To make RStudio use the right one I click and hold down the Control key when I start RStudio.
This opens a "Choosing R Installation" pop-up where I can select the R binary I need.
The problem is that - unlike in this RStudio support article - the pop-up shows only the very last version of R that I used.
So whenever I switch projects I have to browse to the R binary that I need.
Is there a way to make RStudio remember the other R versions I've used?
If there isn't, where does RStudio look for the last used one? If I knew that, I could probably use a script to overwrite it before launching RStudio.
Some details:
I am on Windows 7/10.
RStudio version is 1.3.1093
None of the registry keys described here are set.
Since you mentioned that you kept the registry clean and under the assumption that you are using distinct/separate folders for each of your projects one COULD be tempted to try something like
a .Renviron file containing R_HOME=C:/path/to/your/required/version or
a .Rprofile file containing Sys.setenv(R_HOME='path/to/your/version')
in your project folder(s)?
Or potentially put a .bat file in there with content like
SET R_HOME=Path/to/your/R.version
cd /D "%~dp0"
start .YourProject.Rproj
BUT NOPE!
Currently this type of functionality/behaviour is NOT available for RStudio Desktop Free (as of time of writing this is RStudio Desktop 1.3.1093) BUT can only be achieved with RStudio Server PRO - see 6.3.3 User Configurable Default Version.
#Evgenil: updated answer based on your suggestion and after I had the time to test the idea as well
I had a similar problem. The way I solved this was by utilizing portable versions of R and RStudio.
To get this to work I needed a few things.
Download portable versions of R, https://sourceforge.net/projects/rportable/files/
Download portable versions of RStudio, https://sourceforge.net/projects/rportable/files/
Download IniFile 1.92, https://www.horstmuc.de/wbat32.htm#inifile
In this example I have created three folders on my desktop.
BatchSetRandRStudio, R-Portable-4.1.2, RStudio-2022.02.3-492
Example steps:
Create a folder to house the batch file that will launch R and RStudio. e.g. C:\Users<username>\Desktop\BatchSetRandRStudio.
Place the downloaded IniFile, inifile.exe, in the folder you just created for the batch file.
Create a batch file with the example code below and change the paths to your specifications for the portable versions of R and RStudio. e.g. Batch4.1.2RLaunchRStudioRun.bat
#echo off
REM Remember to update the Rprofile.site within each R-Portable location, in the etc folder for each portable R version:
REM C:\Users\<username>\Desktop\R-Portable-4.1.2\App\R-Portable\etc
REM .First = function(){
REM .libPaths(.Library)
REM }
REM Also the portable R library location is located:
REM C:\Users\<username>\Desktop\R-Portable-4.1.2\App\R-Portable\library
:: INI editor; inifile.exe needs to be in same folder of batch file to work
:: Source: https://www.horstmuc.de/wbat32.htm#inifile
:: INIFILE filename [section] item=string
:: inifile.exe "C:\Users\<username>\AppData\Roaming\RStudio\desktop.ini" [General] RBinDir=C:/Users/<username>/Desktop/R-Portable-4.1.2/App/R-Portable/bin/x64
inifile.exe "C:\Users\<username>\AppData\Roaming\RStudio\desktop.ini" [General] RBinDir=C:/Users/<username>/Desktop/R-Portable-4.1.2/App/R-Portable/bin/x64
:: FOR R 4.1.2
:: Start Program
:: start "" "C:\Users\<project folder>\Desktop\RStudio-2022.02.3-492\bin\rstudio.exe"
start "" "C:\Users\<username>\Desktop\RStudio-2022.02.3-492\bin\rstudio.exe"
:: FOR R 4.1.2
:: Start Program and specific project
:: start "" "C:\Users\<username>\Desktop\RStudio-2022.02.3-492\bin\rstudio.exe" "C:\Users\<username>\Desktop\R-Portable-4.1.2\Projects\<project folder>\<project name>.Rproj" & :: This command starts RStudio and opens specific project
Update the Rprofile.site file within each R-Portable location (allows one to have separate package installations for each portable version you create) with the following code:
.First = function(){
.libPaths(.Library)
}
Run the batch file, RStudio should open with the version of R you have pointed it to as well as the version of RStudio you have specified. You should be able to add projects and create specific batch files to open each project separately.

How to build qpdf on Windows?

When running the checks for my R-package (via devtools::check()) I face the warning ''qpdf' is needed for checks on size reduction of PDFs. I found this question were it was suggested (if I understood the answer correctly) to run Sys.which(Sys.getenv("R_QPDF", "qpdf")) and see whether qpdf is found or not. In my case this just returns
qpdf
""
so, I think I didn't install qpdf correctly. Unfortunately it seems to be quite complicated to install qpdf on Windows. My first side question is: does it really is so painful and complicated to install qpdf for Windows or is there an easy solution?
I've followed the instructions until it is said to add C:\MinGW-w64\bin and C:\MinGW-w64\lib\mingw to the PATH variable. But then I don't find further specific instructions to install qpdf, only about how to build qpdf with different other programs. The second side question is: is my assumption correct that after I've build qpdf it is installed? But the real question is: What is the best way to build qpdf? I tried the ./config-mingw32 and ./config-mingw64 commands from the section "Building with MinGW" in my C:\MinGW\msys\1.0\bin\bash.exe but got the error messages ./config-mingw32: No such file or directory and have no idea how to fix this issue.
I'm using Windows 10, R version 3.3.2 Patched (2017-01-07 r71934) -- "Sincere Pumpkin Patch" and RStudio 1.0.136.
You basically do not need to build the file on windows. Please follow three steps below:
Download qpdf for windows from https://sourceforge.net/projects/qpdf/?source=typ_redirect
Extract files in a temp folder
Copy the contents of the bin folder to %SystemRoot%\System32
job done!
Sys.which(Sys.getenv("R_QPDF", "qpdf"))
qpdf
"C:\\WINDOWS\\SYSTEM32\\qpdf.exe"
To flesh out an answer provided elsewhere:
If you are running the 32-bit version of R, it is important that you download the 32-bit version of qpdf, which is the version linked from the SourceForge homepage. If you are running a 64-bit installation of R, you will need to do a bit of digging to locate the 64-bit version of qpdf, which is buried a little more deeply (version 10.0.1 is listed here).
Rather than copying files to C:/Windows/System32, a potentially safer option is to extracted the zipped qpdf directory to C:\Program Files. If you do this, you'll need to add C:\Program Files\qpdf-version_number\bin to your system PATH under the environment variables.
To do this within R, run Sys.setenv('PATH' = paste0('C:\Program Files\qpdf-version_numer\bin;', Sys.getenv('PATH')))
To do this in Windows, open the start menu, type "edit the system environment variables" to open the System Properties, and at the bottom of the "Advanced" tab click "Environment variables". Find the "Path" entry under "System variables" and click "Edit". Then, re-start R so it picks up the modified PATH.
One further step may be required to convince Windows that pqdf is safe to run.
Navigate to C:\Program Files\qpdf-version_numer\bin and execute qpdf.exe (by double-clicking). Windows 10 throws up a security warning, as it's an unrecognized executable file. You'll need to use the more options link to find the button to run the program. This done, Windows will recognize the file as safe to run and allow other software, including R, to use it.

Emacs org files encryption in MS Windows

I would like to encrypt my org files(org-mode) or a region of the file in emacs. The option given in the tool does not work (gives me the error apply: Searching for program: no such file or directory, gpg). I guess because I am using emacs on windows and all the search on this topic point towards encrypting the files on UNIX platform. Can you please help me on how encryption can be achieved on windows. Thanks in advance.
I am using ergoemacs for windows downloaded from http://ergoemacs.org/index.html. The version is as follows:
GNU Emacs 24.2.1 (i386-mingw-nt6.1.7601) of 2012-08-29 on MARVIN ErgoEmacs distribution 2.0.0
Install GnuPG onto your Windows machine. Binary versions (i.e. ones that you don't have to compile yourself) are available from http://gpg4win.org/.
Once GnuPG is installed, and assuming you add its binary directory to your Windows %PATH%, Emacs should be able to use it.
solved the problem by installing cygwin (which has GPG installed) and using the same in emacs.
This can be done by giving the cgywin installed directory in the option cygwin-root-directory of the emacs editor

Advice on upgrading Emacs (22 -> 24), and also about GUI vs console/terminal

I'm using a Macbook Pro (Snow Leopard, 10.6.8) and have been a regular emacs user for the past few months. I'm trying to install a modified version of Emacs 24.2 provided here to utilize Emacs Speaks Statistics (ESS) from the downloads page. I currently have 22.1.1:
M-x emacs-version
GNU Emacs 22.1.1 (mac-apple-darwin) of 2011-06-07 on b1030.apple.com
I installed the emacs linked earlier, put it in Applications, and set this in .bashrc:
alias emacs="/Applications/Emacs.app/Contents/MacOS/Emacs -nw"
So it seems like it's working correctly as I wrote and successfully ran a short R program.
M-x emacs-version
GNU Emacs 24.2.1 (x86_64-apple-darwin, NS apple-appkit-1038.36) of 2012-08-27 on bob.porkrind.org
Is this the usual way to upgrade to a "newer version" of Emacs? Sorry if this question seems trivial, but I've never done this before (I typically used emacs on a different computer) and the Installation step on the previous website consists of just one sentence. The all-in-one installation method also isn't explained in the official documentation.
A brief side note while I was searching on the web: I believe calling 'emacs file_name' should open a GUI version, while 'emacs -nw file_name' is the console, so I remain using the terminal. But on my Mac, using emacs has the same effect as using emacs -nw. In other words, I can't get a GUI or separate window to show up. Can anyone confirm that this Super User question has the 'correct' answer? (I don't really have a problem with this, as I hate having another pop-up window, but it would be nice to know for completeness.)
The Emacs that comes with Mac OS X /usr/bin/emacs does not have a graphical interface, just the terminal one, so calling emacs is the same as emacs -nw.
Your upgraded Emacs by default starts with the graphical interface, so you need to specify -nw to force it to use the terminal.
There is no "usual" way to upgrade OS X's default Emacs (i.e. Apple does not provide an upgraded Emacs); what you've done is fine. Or you could install a binary from http://emacsformacosx.com/ or use a package manager like homebrew.

Resources