Posts Tagged ‘print’

Exit command in R

Posted: 26th April 2015 by Tim in R
Tags: , , , , , ,

R is quite different from most other programming languages. One common feature of other languages is the exit routine, or something with a similar name. In R, that function is stop, and takes an error message string as an argument. For example: stop(“I don’t work on weekends”) will print: Error: I don’t work on weekends […]

There are many ways in the linux terminal to print the nth word of a given file or output. One way to do this without worrying about tabs, extra spaces or word length is to use awk. With awk, this can be done on one line by using the {print $<n>} syntax. For example, the […]

There are a number of ways to print a number with zero-padding (leading zeros), depending on the variable type you are wanting to print. One easy way to add zero padding to any type is to use the str(<number>).zfill(<length>). This will convert any number type to a string before adding the extra zeros. For example: […]

My first FORTRAN 77 program

Posted: 27th September 2011 by Tim in Fortran
Tags: , , , , , , , , , ,

With sophisticated programming languages such as C++ and Java, it’s surprising to learn that FORTRAN is still widely used in the real world. FORTRAN 77, although approaching 35 years old, forms the backbone of many large-scale systems, and requires maintenance every now and then. I also believe that knowing basic FORTRAN 77 provides a useful […]