R


  • Starting your Jupyter Notebook with a double-click

    Jupyter Notebooks are a great way of working with Python and R. You can add your notes in Markdown and write code in a cell that can be evaluated over and over again.

    However, one thing I didn’t like is that you have to start (on Windows) the Jupyter Notebook server in the directory where you have your notebook saved. Double-clicking a Jupyter notebook (with the extension ipynb) doesn’t work if you don’t install an additional package. Luckily, there is an easy way to get this working found on Axel’s blog.

    I used the following code to enable double-click … Read the rest “Starting your Jupyter Notebook with a double-click”

  • Generating headings for project files

    I use the free software AutoHotkey (AHK) for automation of many things. One of those things is generating headings for my project file. I developed a simple AHK-script that asks me for the project name, the topic and then inserts the heading with additional information like my name, my E-mail address and a keyword for subversion.

    The script is quite simple and I have adopted it for headings for several project files (tex, R and gams). The only difference being the characters used to comment out a line.

    Here is the script

    Read the rest “Generating headings for project files”

  • Automatic operator formatting mode in Emacs

    Emacs has a nice new mode called electric-operator developed by David Spepherd. It helps when you write code by formatting all operators in a predefined way. For example, in R it adds spaces around the operator signs, when you write 1+1, this is automatically converted into 1 + 1.

    You can define your own way of formatting for other modes. For gams-mode you add the following to your .emacs file

    Read the rest “Automatic operator formatting mode in Emacs”

  • Column guide in Emacs

    Many professional editors have a column guide. For example, below you see in the Powershell editor a veritcal line at column 80.

    image

    This marker comes in handy, if you want to print your files. In Emacs I usually check for the column 80 in the status line.

    image

    However, I usually forget to check, and when I print out stuff or publish, I got line breaks where I don’t want them. Passing the 80th column for comments is not a problem, as a simple Ctrl-q forces Emacs to break the lines nicely and add comment symbols at the beginning.

    image

    But after … Read the rest “Column guide in Emacs”

  • Using file templates in Emacs

    A good practice in modeling is to place information related to the project your are working on, the subject, the data and your personal information like E-mail address at the top of your file. In Emacs you can define skeleton functions that will prompt for the information and put it in the file. Below is an example for a file with as comment symbol “**: (the $Id: $ is for my version control system, that automatically will add the information on the last commit in this line).

    image

    Below you see how to make a function using skeleton. As I don’t … Read the rest “Using file templates in Emacs”


Categories

Name *

Email *