Notes on Ubuntu (Linux) computing

Brief notes on installation, setup and other tasks in the Ubuntu world

Archive for the ‘R’ Category

Install vim-template vim plugin

leave a comment »

The vim-template plugin allows for the use of templates for different file types: *.html, *.py and so on. Following the installation instructions (see above link), we use pathogen to install the plugin:

cd ~/.vim/bundle
git clone git://github.com/aperezdc/vim-template.git

Use of plugin

Now, you can make use of the templates when starting vim. For example, a python template is loaded by recognition of the *.py filename:

vim test.py

Or, if you have new buffer, type the following for the template to be loaded inside vim:

:Template py

The available templates can be seen here. Using the pathogen installation described above, these templates are located (on your machine) at ~/.vim/bundle/vim-template/templates/.

Customization

If you want to customize certain fields, like email and username, you can add the following to your .vimrc file:

" Customize the settings for vim-template plugin                                
let g:email = "desiredemail@gmail.com"
let g:user = "Desired Name"                                         
let g:license = "Desired License"

If you want to customize the templates, there is a search order for templates (see here) allowing you to write your own template-files and store them in the local directory.

Advertisements

Written by Chris S

November 7, 2013 at 7:28 pm

Posted in computing, Java, LaTeX, Python, R

Tagged with , , , ,

Installing pomp in R

leave a comment »

pomp (partially-observed Markov processes) is a package in R for simulating stochastic and deterministic mathematical models as well as to infer parameters using observed data — also see the r-forge page. I will provide (very) brief install instructions here and provide examples of use in later posts.

Install by going to the command line and starting R using sudo (I assume you are using Ubuntu here):

sudo R

Once in R, type:

install.packages('pomp', dep = TRUE)

The pomp package and other packages it requires will be downoaded, compiled, and installed. You can test that pomp is available by loading the package in an R session:

library(pomp)

Written by Chris S

December 22, 2012 at 7:02 pm

Installing R on Ubuntu 12.04

with 13 comments

I install R using the instructions at cran.r-project.org (direct link to instructions). At the website, click ‘Download R for Linux’ then ‘ubuntu’ to get the most up-to-date instructions. Following these instructions, my process was as follows:

Add the repository, using the CRAN server of your choice (I use UCLA here) and the appropriate Ubuntu version (I use precise for Ubuntu 12.04):

sudo add-apt-repository "deb http://cran.stat.ucla.edu/bin/linux/ubuntu precise/"

For security, get the key and add it to your keyring (NOTE: the CRAN website says that some people are having issues with this step — if the commands here do not work for you, check there for latest information):

gpg --keyserver keyserver.ubuntu.com --recv-key E084DAB9
gpg -a --export E084DAB9 | sudo apt-key add -

Next, update and install (the documentation says you might want to install r-base-dev as well, but I found this package is already included using the commands below):

sudo apt-get update
sudo apt-get install r-base

Installing packages

To install package not in the base set, use the following commands

sudo R

Now, inside R, install package packagename with

install.packages('packagename', dep = TRUE)

Note — the quotes around the packagename ARE needed.

Updating packages

Again, start R with sudo:

sudo R

Now, inside R, update packages with

update.packages(ask = FALSE)

rstudio

I do much of my coding in Geany irrespective of the language. However, the rstudio IDE/GUI is nice and available on all major platforms (Win,MAC,Linux) making it useful for teaching R.

  • Download the debian package from http://www.rstudio.org
  • I downloaded RStudio 0.97.237 – Debian 6+/Ubuntu 10.04+ (64-bit) — this is actually a file: rstudio-0.97.237-amd64.deb
  • If all dependencies are installed (output will complain if not), install rstudio-0.97.237-amd64.deb file using
    sudo dpkg -i rstudio-0.97.237-amd64.deb
    

    I got a complaint about libjpeg62 and installed is using:

    sudo apt-get install libjpeg62
    

    followed by the installation of the deb file, as shown above.

Written by Chris S

December 9, 2012 at 10:51 pm

Posted in R, Ubuntu 12.04

Tagged with , ,