# Adding a Cron job using the ed editor

These commands (after the first one) work in the ed editor. ed editor is used in the RStudio server shell. sudo crontab -e #opens crontab file in chosen editor a #add to file 0,30 * * * * Rscript /home/user/folder/script.R #command to add . #finished editing ,p #print file content to check w #save changes Q #quit In this example the script will run every 0 hours, 30 minutes, see Ubuntu: How do I set up a CRON job for other options.

# How long did my R script run?

This to the beginning: strt<-Sys.time() And this to the end: print(Sys.time()-strt) Example output: print(Sys.time()-strt) Time difference of 16.39691 secs

# Adding space between rows in LaTex tables

By default, LaTex tables are very tight: \usepackage{booktabs} \begin{table}[] \centering \caption{My caption} \label{my-label} \begin{tabular}{@{}lll@{}} \toprule Rows & Column 1 & Column 2 \\ \midrule Row 1 & 1234 & 2345 \\ Row 2 & 3456 & 4567 \\ Row 3 & 5678 & 6789 \\ Row 4 & 7890 & 8901 \\ Row 5 & 9012 & 10000 \\ \bottomrule \end{tabular} \end{table} Adding this to the document preamble will add space between the rows:

# My minimal LaTex preamble


# How to "increase" array resolution in R (replicate each element both column-wise and row-wise)

One picture says more than a thousand words. You have what is one the left, and you want what is on the right. my_matrix = matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), nrow=3) #matrix is a 2D array, this next row creates a third dimension, #duplicating the data my_array = array(my_matrix, dim = c(3,3,2)) There are a few different ways to do this, but by far the cleanest and quickest way is to just select the rows and columns multiple times, by replicating row and column numbers (instead of actually replicating each element):

# Cut a time period from netCDF with nco

ncks -d time,start_time,end_time in.nc out.nc start_time and end_time are integers. Add -F, if you want to use Fortran indexing (to start from 1). No space between dimension name and start-end points!
• page 3 of 5

#### Riinu Pius (Ots)

if it aint broke, you’re outdated

Senior Data Manager

Edinburgh, UK