Having installed Cygwin, put Makefile and mysrc.f in a suitable directory (c:/Home/Research/Expt assumed below), then type make Then go into R, and type setwd('c:/Home/Research/Expt') source('myfun.R') a<-matrix(sample(20),4,5) a myfun(a,3) a[order(a[,3]),]